Commit 6e692ed37a507e18d8afe8e5faebd8c4722c5f12

Authored by John Hawkes
Committed by Linus Torvalds
1 parent 962749af67

[PATCH] fix alloc_large_system_hash() roundup

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 <hawkes@sgi.com>
Cc: Roland Dreier <rdreier@cisco.com>
Cc: "Chen, Kenneth W" <kenneth.w.chen@intel.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>

Showing 1 changed file with 1 additions and 2 deletions Side-by-side Diff

... ... @@ -2702,8 +2702,7 @@
2702 2702 else
2703 2703 numentries <<= (PAGE_SHIFT - scale);
2704 2704 }
2705   - /* rounded up to nearest power of 2 in size */
2706   - numentries = 1UL << (long_log2(numentries) + 1);
  2705 + numentries = roundup_pow_of_two(numentries);
2707 2706  
2708 2707 /* limit allocation size to 1/16 total memory by default */
2709 2708 if (max == 0) {