kernel-ark/arch/powerpc/kernel
Linus Torvalds 89f5b7da2a Reinstate ZERO_PAGE optimization in 'get_user_pages()' and fix XIP
KAMEZAWA Hiroyuki and Oleg Nesterov point out that since the commit
557ed1fa26 ("remove ZERO_PAGE") removed
the ZERO_PAGE from the VM mappings, any users of get_user_pages() will
generally now populate the VM with real empty pages needlessly.

We used to get the ZERO_PAGE when we did the "handle_mm_fault()", but
since fault handling no longer uses ZERO_PAGE for new anonymous pages,
we now need to handle that special case in follow_page() instead.

In particular, the removal of ZERO_PAGE effectively removed the core
file writing optimization where we would skip writing pages that had not
been populated at all, and increased memory pressure a lot by allocating
all those useless newly zeroed pages.

This reinstates the optimization by making the unmapped PTE case the
same as for a non-existent page table, which already did this correctly.

While at it, this also fixes the XIP case for follow_page(), where the
caller could not differentiate between the case of a page that simply
could not be used (because it had no "struct page" associated with it)
and a page that just wasn't mapped.

We do that by simply returning an error pointer for pages that could not
be turned into a "struct page *".  The error is arbitrarily picked to be
EFAULT, since that was what get_user_pages() already used for the
equivalent IO-mapped page case.

[ Also removed an impossible test for pte_offset_map_lock() failing:
  that's not how that function works ]

Acked-by: Oleg Nesterov <oleg@tv-sign.ru>
Acked-by: Nick Piggin <npiggin@suse.de>
Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Hugh Dickins <hugh@veritas.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Roland McGrath <roland@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-06-20 11:18:25 -07:00
..
vdso32
vdso64
align.c
asm-offsets.c Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc 2008-04-29 08:19:14 -07:00
audit.c
btext.c [POWERPC] Remove duplicate #include 2008-05-09 20:22:58 +10:00
clock.c
compat_audit.c
cpu_setup_6xx.S [POWERPC] ppc32: Fix errata for 603 CPUs 2008-04-21 15:00:32 -05:00
cpu_setup_44x.S [POWERPC] 4xx: Fix 460GT support to not enable FPU 2008-04-24 13:32:47 -05:00
cpu_setup_pa6t.S
cpu_setup_ppc970.S
cputable.c [POWERPC] Fix default cputable entries for e200 and e500 families 2008-05-12 14:20:35 +10:00
crash_dump.c
crash.c
dma_64.c
entry_32.S [POWERPC] Add IRQSTACKS support on ppc32 2008-04-29 15:57:34 +10:00
entry_64.S [POWERPC] irqtrace support for 64-bit powerpc 2008-04-18 15:38:47 +10:00
firmware.c
fpu.S
head_8xx.S
head_32.S [POWERPC] Move stackframe definitions to common header 2008-04-18 15:37:18 +10:00
head_40x.S
head_44x.S [POWERPC] 4xx: Clear new TLB cache attribute bits in Data Storage vector 2008-06-18 21:40:43 +10:00
head_64.S [POWERPC] Fix bogus paca->_current initialization 2008-05-09 20:22:58 +10:00
head_booke.h
head_fsl_booke.S [POWERPC] 85xx: Add support for relocatable kernel (and booting at non-zero) 2008-04-24 20:58:01 +10:00
ibmebus.c
idle_6xx.S
idle_power4.S
idle.c
init_task.c [PATCH] take init_files to fs/file.c 2008-05-16 17:22:20 -04:00
io.c
iomap.c
iommu.c
irq.c [POWERPC] Fix return value check logic in debugfs virq_mapping setup 2008-06-16 15:00:25 +10:00
isa-bridge.c [POWERPC] Remove leftover printk in isa-bridge.c 2008-05-09 20:22:59 +10:00
kprobes.c
l2cr_6xx.S
legacy_serial.c
lparcfg.c powerpc: use non-racy method for proc entries creation 2008-04-29 08:06:22 -07:00
machine_kexec_32.c
machine_kexec_64.c
machine_kexec.c [POWERPC] Fix crashkernel= handling when no crashkernel= specified 2008-04-30 19:49:48 +10:00
Makefile [POWERPC] ppc: Don't run prom_init_check for arch/ppc builds 2008-05-12 20:27:50 +10:00
misc_32.S [POWERPC] Add IRQSTACKS support on ppc32 2008-04-29 15:57:34 +10:00
misc_64.S [POWERPC] Clean up misc_64.S 2008-04-24 20:58:03 +10:00
misc.S
module_32.c
module_64.c
msi.c
nvram_64.c
of_device.c
of_platform.c [POWERPC] cell: Generalize io-workarounds code 2008-04-24 21:08:12 +10:00
paca.c [POWERPC] Raise the upper limit of NR_CPUS and move the pacas into the BSS 2008-04-24 20:58:04 +10:00
pci_32.c
pci_64.c [POWERPC] Use dev_set_name in pci_64.c 2008-06-09 11:32:40 +10:00
pci_dn.c
pci-common.c PCI: powerpc: use generic pci_enable_resources() 2008-04-20 21:47:05 -07:00
pmc.c
ppc32.h Revert "[POWERPC] Add compat handler for PTRACE_GETSIGINFO" 2008-04-24 14:05:15 +10:00
ppc_ksyms.c [POWERPC] Remove ppc32's export of console_drivers 2008-06-16 15:00:56 +10:00
proc_ppc64.c powerpc: use non-racy method for proc entries creation 2008-04-29 08:06:22 -07:00
process.c [POWERPC] Add IRQSTACKS support on ppc32 2008-04-29 15:57:34 +10:00
prom_init_check.sh [POWERPC] Fix -Os kernel builds with newer gcc versions 2008-06-16 15:00:54 +10:00
prom_init.c
prom_parse.c
prom.c [POWERPC] 85xx: Add support for relocatable kernel (and booting at non-zero) 2008-04-24 20:58:01 +10:00
ptrace32.c Revert "[POWERPC] Add compat handler for PTRACE_GETSIGINFO" 2008-04-24 14:05:15 +10:00
ptrace.c
rtas_flash.c powerpc: use non-racy method for proc entries creation 2008-04-29 08:06:22 -07:00
rtas_pci.c
rtas-proc.c powerpc: use non-racy method for proc entries creation 2008-04-29 08:06:22 -07:00
rtas-rtc.c
rtas.c Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc 2008-04-21 15:50:49 -07:00
setup_32.c [POWERPC] Add IRQSTACKS support on ppc32 2008-04-29 15:57:34 +10:00
setup_64.c [POWERPC] Initialize lockdep earlier 2008-05-09 20:22:58 +10:00
setup-common.c
setup.h
signal_32.c [POWERPC] Define copy_siginfo_from_user32 2008-04-20 13:03:36 +10:00
signal_64.c [POWERPC] Fix incorrect enabling of VMX when building signal or user context 2008-06-09 11:32:36 +10:00
signal.c
signal.h
smp-tbsync.c
smp.c [POWERPC] Bolt in SLB entry for kernel stack on secondary cpus 2008-05-02 15:00:45 +10:00
softemu8xx.c
stacktrace.c [POWERPC] Fix new warnings arising from stacktrace patch 2008-04-24 20:58:02 +10:00
suspend.c
swsusp_32.S
swsusp_64.c
swsusp_asm64.S
swsusp.c
sys_ppc32.c Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc 2008-04-21 15:50:49 -07:00
syscalls.c unified (weak) sys_pipe implementation 2008-05-03 13:50:33 -07:00
sysfs.c
systbl_chk.c
systbl_chk.sh
systbl.S
tau_6xx.c
time.c ntp: rename TICK_LENGTH_SHIFT to NTP_SCALE_SHIFT 2008-05-01 08:03:59 -07:00
traps.c
udbg_16550.c
udbg.c [POWERPC] Mark udbg console as CON_ANYTIME, ie. callable early in boot 2008-04-24 21:08:11 +10:00
vdso.c Reinstate ZERO_PAGE optimization in 'get_user_pages()' and fix XIP 2008-06-20 11:18:25 -07:00
vecemu.c
vector.S
vio.c
vmlinux.lds.S