On Mon, 27 Oct 2014 23:02:13 +0800 Fengwei Yin <yfw.kernel@xxxxxxxxx> wrote: > We could see following memory info in /proc/xxxx/smaps with THP enabled. > 7bea458b3000-7fea458b3000 r--p 00000000 00:13 39989 /dev/zero > Size: 4294967296 kB > Rss: 10612736 kB > Pss: 10612736 kB > Shared_Clean: 0 kB > Shared_Dirty: 0 kB > Private_Clean: 10612736 kB > Private_Dirty: 0 kB > Referenced: 10612736 kB > Anonymous: 0 kB > AnonHugePages: 10612736 kB > Swap: 0 kB > KernelPageSize: 4 kB > MMUPageSize: 4 kB > Locked: 0 kB > VmFlags: rd mr mw me > which is wrong becuase just huge_zero_page/normal_zero_page is used for > /dev/zero. Most of the value should be 0. > > This patch detects huge_zero_page (original implementation just detect > normal_zero_page) and avoids to update the wrong value for huge_zero_page. > > ... > > --- a/mm/memory.c > +++ b/mm/memory.c > @@ -41,6 +41,7 @@ > #include <linux/kernel_stat.h> > #include <linux/mm.h> > #include <linux/hugetlb.h> > +#include <linux/huge_mm.h> > #include <linux/mman.h> > #include <linux/swap.h> > #include <linux/highmem.h> > @@ -787,6 +788,9 @@ check_pfn: > return NULL; > } > > + if (is_huge_zero_pfn(pfn)) > + return NULL; > + Why this change? What effect does it have upon vm_normal_page()'s many existing callers? -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@xxxxxxxxx. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"dont@xxxxxxxxx"> email@xxxxxxxxx </a>