• Hugh Dickins's avatar
    mm: reinstate ZERO_PAGE · a13ea5b7
    Hugh Dickins authored
    KAMEZAWA Hiroyuki has observed customers of earlier kernels taking
    advantage of the ZERO_PAGE: which we stopped do_anonymous_page() from
    using in 2.6.24.  And there were a couple of regression reports on LKML.
    
    Following suggestions from Linus, reinstate do_anonymous_page() use of
    the ZERO_PAGE; but this time avoid dirtying its struct page cacheline
    with (map)count updates - let vm_normal_page() regard it as abnormal.
    
    Use it only on arches which __HAVE_ARCH_PTE_SPECIAL (x86, s390, sh32,
    most powerpc): that's not essential, but minimizes additional branches
    (keeping them in the unlikely pte_special case); and incidentally
    excludes mips (some models of which needed eight colours of ZERO_PAGE
    to avoid costly exceptions).
    
    Don't be fanatical about avoiding ZERO_PAGE updates: get_user_pages()
    callers won't want to make exceptions for it, so increment its count
    there.  Changes to mlock and migration? happily seems not needed.
    
    In most places it's quicker to check pfn than struct page address:
    prepare a __read_mostly zero_pfn for that.  Does get_dump_page()
    still need its ZERO_PAGE check? probably not, but keep it anyway.
    Signed-off-by: default avatarHugh Dickins <hugh.dickins@tiscali.co.uk>
    Acked-by: default avatarRik van Riel <riel@redhat.com>
    Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
    Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
    Cc: Nick Piggin <npiggin@suse.de>
    Cc: Mel Gorman <mel@csn.ul.ie>
    Cc: Minchan Kim <minchan.kim@gmail.com>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    a13ea5b7
memory.c 92.4 KB