hugepage: support ZERO_PAGE()
commit4b2e38ad703541f7845c2d766426148b8d1aa329
authorKOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Sun, 19 Oct 2008 03:27:10 +0000 (18 20:27 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Mon, 20 Oct 2008 15:52:32 +0000 (20 08:52 -0700)
treeaaafbec5325d15c38c382c655120fb6492c11f82
parente575f111dc0f27044e170580e7de50985ab3e011
hugepage: support ZERO_PAGE()

Presently hugepage doesn't use zero page at all because zero page is only
used for coredumping and hugepage can't core dump.

However we have now implemented hugepage coredumping.  Therefore we should
implement the zero page of hugepage.

Implementation note:

o Why do we only check VM_SHARED for zero page?
  normal page checked as ..

static inline int use_zero_page(struct vm_area_struct *vma)
{
        if (vma->vm_flags & (VM_LOCKED | VM_SHARED))
                return 0;

        return !vma->vm_ops || !vma->vm_ops->fault;
}

First, hugepages are never mlock()ed.  We aren't concerned with VM_LOCKED.

Second, hugetlbfs is a pseudo filesystem, not a real filesystem and it
doesn't have any file backing.  Thus ops->fault checking is meaningless.

o Why don't we use zero page if !pte.

!pte indicate {pud, pmd} doesn't exist or some error happened.  So we
shouldn't return zero page if any error occurred.

Signed-off-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Cc: Adam Litke <agl@us.ibm.com>
Cc: Hugh Dickins <hugh@veritas.com>
Cc: Kawai Hidehiro <hidehiro.kawai.ez@hitachi.com>
Cc: Mel Gorman <mel@skynet.ie>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
mm/hugetlb.c