The patch titled Subject: proc-kpagecount-return-0-for-special-pages-that-are-never-mapped-v2 has been added to the -mm tree. Its filename is proc-kpagecount-return-0-for-special-pages-that-are-never-mapped-v2.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/proc-kpagecount-return-0-for-special-pages-that-are-never-mapped-v2.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/proc-kpagecount-return-0-for-special-pages-that-are-never-mapped-v2.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Anthony Yznaga <anthony.yznaga@xxxxxxxxxx> Subject: proc-kpagecount-return-0-for-special-pages-that-are-never-mapped-v2 incorporate feedback from Matthew Wilcox Link: http://lkml.kernel.org/r/1544481313-27318-1-git-send-email-anthony.yznaga@xxxxxxxxxx Signed-off-by: Anthony Yznaga <anthony.yznaga@xxxxxxxxxx> Acked-by: Matthew Wilcox <willy@xxxxxxxxxxxxx> Cc: Naoya Horiguchi <n-horiguchi@xxxxxxxxxxxxx> Cc: Vlastimil Babka <vbabka@xxxxxxx> Cc: David Rientjes <rientjes@xxxxxxxxxx> Cc: Alexey Dobriyan <adobriyan@xxxxxxxxx> Cc: Kirill A. Shutemov <kirill.shutemov@xxxxxxxxxxxxxxx> Cc: Mike Rapoport <rppt@xxxxxxxxxxxxxxxxxx> Cc: Michal Hocko <mhocko@xxxxxxxx> Cc: Alexander Duyck <alexander.h.duyck@xxxxxxxxxxxxxxx> Cc: Johannes Weiner <hannes@xxxxxxxxxxx> Cc: Miles Chen <miles.chen@xxxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- --- a/include/linux/page-flags.h~proc-kpagecount-return-0-for-special-pages-that-are-never-mapped-v2 +++ a/include/linux/page-flags.h @@ -669,19 +669,18 @@ PAGEFLAG_FALSE(DoubleMap) #define PAGE_TYPE_BASE 0xf0000000 /* Reserve 0x0000007f to catch underflows of page_mapcount */ +#define PAGE_MAPCOUNT_RESERVE -128 #define PG_buddy 0x00000080 #define PG_balloon 0x00000100 #define PG_kmemcg 0x00000200 #define PG_table 0x00000400 -#define PAGE_TYPE_ALL (PG_buddy | PG_balloon | PG_kmemcg | PG_table) #define PageType(page, flag) \ ((page->page_type & (PAGE_TYPE_BASE | flag)) == PAGE_TYPE_BASE) static inline int page_has_type(struct page *page) { - return (PageType(page, 0) && - ((page->page_type & PAGE_TYPE_ALL) != PAGE_TYPE_ALL)); + return (int)page->page_type < PAGE_MAPCOUNT_RESERVE; } #define PAGE_TYPE_OPS(uname, lname) \ _ Patches currently in -mm which might be from anthony.yznaga@xxxxxxxxxx are tools-vm-page-typesc-fix-kpagecount-returned-fewer-pages-than-expected-failures.patch proc-kpagecount-return-0-for-special-pages-that-are-never-mapped.patch proc-kpagecount-return-0-for-special-pages-that-are-never-mapped-v2.patch