2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2024-12-18 18:23:53 +08:00
linux-next/arch/powerpc
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
..
boot [POWERPC] Fix bootwrapper builds with newer gcc versions 2008-06-16 15:00:52 +10:00
configs [POWERPC] Turn on ATA_SFF so we get SATA_SVW back in defconfigs 2008-06-16 21:14:12 +10:00
kernel Reinstate ZERO_PAGE optimization in 'get_user_pages()' and fix XIP 2008-06-20 11:18:25 -07:00
kvm KVM: ppc: Report bad GFNs 2008-06-06 21:22:41 +03:00
lib [POWERPC] Fix -Os kernel builds with newer gcc versions 2008-06-16 15:00:54 +10:00
math-emu [POWERPC] Replace remaining __FUNCTION__ occurrences 2008-04-01 20:43:09 +11:00
mm [POWERPC] Clear sub-page HPTE present bits when demoting page size 2008-06-18 21:40:43 +10:00
oprofile Merge branch 'linux-2.6' 2008-04-14 21:11:02 +10:00
platforms [POWERPC] Fix warning in pseries/eeh_driver.c 2008-06-16 15:00:44 +10:00
sysdev rtc-ds1374: rename device to just "ds1374" 2008-06-06 11:29:10 -07:00
xmon powerpc/spufs: remove class_0_dsisr from spu exception handling 2008-06-16 14:35:00 +10:00
.gitignore [POWERPC] Add files build to .gitignore 2006-12-04 20:41:29 +11:00
Kconfig [RAPIDIO] Add RapidIO option to kernel configuration 2008-04-29 19:40:27 +10:00
Kconfig.debug [POWERPC] Add IRQSTACKS support on ppc32 2008-04-29 15:57:34 +10:00
Makefile [POWERPC] Fix -Os kernel builds with newer gcc versions 2008-06-16 15:00:54 +10:00