]> Git Repo - linux.git/commitdiff
[PATCH] fix alloc_large_system_hash() roundup
authorJohn Hawkes <[email protected]>
Sat, 25 Mar 2006 11:08:02 +0000 (03:08 -0800)
committerLinus Torvalds <[email protected]>
Sat, 25 Mar 2006 16:22:58 +0000 (08:22 -0800)
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 <[email protected]>
Cc: Roland Dreier <[email protected]>
Cc: "Chen, Kenneth W" <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
mm/page_alloc.c

index 637f57ff5b5a1b55990bc4940492268601111c44..338a02bb004d3b3f37f49711ad05baaaa1e7d529 100644 (file)
@@ -2702,8 +2702,7 @@ void *__init alloc_large_system_hash(const char *tablename,
                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) {
This page took 0.052419 seconds and 4 git commands to generate.