From: John Hawkes The "rounded up to nearest power of 2 in size" algorithm in alloc_large_system_hash is not correct. As coded, it takes an otherwise acceptable power-of-2 value and doubles it. For example, we see the error if we boot with thash_entries=2097152 which produces a hash table with 4194304 entries. Signed-off-by: John Hawkes Cc: Roland Dreier Cc: "Chen, Kenneth W" Signed-off-by: Andrew Morton --- mm/page_alloc.c | 3 +-- 1 files changed, 1 insertion(+), 2 deletions(-) diff -puN mm/page_alloc.c~fix-alloc_large_system_hash-roundup mm/page_alloc.c --- 25/mm/page_alloc.c~fix-alloc_large_system_hash-roundup Wed Mar 15 16:00:06 2006 +++ 25-akpm/mm/page_alloc.c Wed Mar 15 16:00:06 2006 @@ -2703,8 +2703,7 @@ void *__init alloc_large_system_hash(con else numentries <<= (PAGE_SHIFT - scale); } - /* rounded up to nearest power of 2 in size */ - numentries = 1UL << (long_log2(numentries) + 1); + numentries = roundup_pow_of_two(numentries); /* limit allocation size to 1/16 total memory by default */ if (max == 0) { _