The patch titled Subject: mm: introduce arch_reserved_kernel_pages() has been added to the -mm tree. Its filename is mm-introduce-arch_reserved_kernel_pages.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/mm-introduce-arch_reserved_kernel_pages.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/mm-introduce-arch_reserved_kernel_pages.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/SubmitChecklist when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Srikar Dronamraju <srikar@xxxxxxxxxxxxxxxxxx> Subject: mm: introduce arch_reserved_kernel_pages() Currently arch specific code can reserve memory blocks but alloc_large_system_hash() may not take it into consideration when sizing the hashes. This can lead to bigger hash than required and lead to no available memory for other purposes. This is specifically true for systems with CONFIG_DEFERRED_STRUCT_PAGE_INIT enabled. One approach to solve this problem would be to walk through the memblock regions and calculate the available memory and base the size of hash system on the available memory. The other approach would be to depend on the architecture to provide the number of pages that are reserved. This change provides hooks to allow the architecture to provide the required info. Link: http://lkml.kernel.org/r/1472476010-4709-2-git-send-email-srikar@xxxxxxxxxxxxxxxxxx Signed-off-by: Srikar Dronamraju <srikar@xxxxxxxxxxxxxxxxxx> Suggested-by: Mel Gorman <mgorman@xxxxxxxxxxxxxxxxxxx> Cc: Vlastimil Babka <vbabka@xxxxxxx> Cc: Michal Hocko <mhocko@xxxxxxxxxx> Cc: Michael Ellerman <mpe@xxxxxxxxxxxxxx> Cc: Mahesh Salgaonkar <mahesh@xxxxxxxxxxxxxxxxxx> Cc: Hari Bathini <hbathini@xxxxxxxxxxxxxxxxxx> Cc: Dave Hansen <dave.hansen@xxxxxxxxx> Cc: Balbir Singh <bsingharora@xxxxxxxxx> Cc: Benjamin Herrenschmidt <benh@xxxxxxxxxxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- include/linux/mm.h | 3 +++ mm/page_alloc.c | 12 ++++++++++++ 2 files changed, 15 insertions(+) diff -puN include/linux/mm.h~mm-introduce-arch_reserved_kernel_pages include/linux/mm.h --- a/include/linux/mm.h~mm-introduce-arch_reserved_kernel_pages +++ a/include/linux/mm.h @@ -1924,6 +1924,9 @@ extern void show_mem(unsigned int flags) extern long si_mem_available(void); extern void si_meminfo(struct sysinfo * val); extern void si_meminfo_node(struct sysinfo *val, int nid); +#ifdef __HAVE_ARCH_RESERVED_KERNEL_PAGES +extern unsigned long arch_reserved_kernel_pages(void); +#endif extern __printf(3, 4) void warn_alloc_failed(gfp_t gfp_mask, unsigned int order, diff -puN mm/page_alloc.c~mm-introduce-arch_reserved_kernel_pages mm/page_alloc.c --- a/mm/page_alloc.c~mm-introduce-arch_reserved_kernel_pages +++ a/mm/page_alloc.c @@ -6944,6 +6944,17 @@ static int __init set_hashdist(char *str __setup("hashdist=", set_hashdist); #endif +#ifndef __HAVE_ARCH_RESERVED_KERNEL_PAGES +/* + * Returns the number of pages that arch has reserved but + * is not known to alloc_large_system_hash(). + */ +static unsigned long __init arch_reserved_kernel_pages(void) +{ + return 0; +} +#endif + /* * allocate a large system hash table from bootmem * - it is assumed that the hash table must contain an exact power-of-2 @@ -6968,6 +6979,7 @@ void *__init alloc_large_system_hash(con if (!numentries) { /* round applicable memory size up to nearest megabyte */ numentries = nr_kernel_pages; + numentries -= arch_reserved_kernel_pages(); /* It isn't necessary when PAGE_SIZE >= 1MB */ if (PAGE_SHIFT < 20) _ Patches currently in -mm which might be from srikar@xxxxxxxxxxxxxxxxxx are mm-page_alloc-replace-set_dma_reserve-to-set_memory_reserve.patch fadump-register-the-memory-reserved-by-fadump.patch mm-introduce-arch_reserved_kernel_pages.patch mm-memblock-expose-total-reserved-memory.patch powerpc-implement-arch_reserved_kernel_pages.patch -- To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html