summaryrefslogtreecommitdiffstats
path: root/mm
diff options
context:
space:
mode:
authorJohn Hawkes <hawkes@sgi.com>2006-03-25 03:08:02 -0800
committerLinus Torvalds <torvalds@g5.osdl.org>2006-03-25 08:22:58 -0800
commit6e692ed37a507e18d8afe8e5faebd8c4722c5f12 (patch)
tree9178f07eb643123d20a95e4ec08477f2c85bd9ea /mm
parent962749af67b145c57917bfbff3c303ebd7d5988c (diff)
downloadop-kernel-dev-6e692ed37a507e18d8afe8e5faebd8c4722c5f12.zip
op-kernel-dev-6e692ed37a507e18d8afe8e5faebd8c4722c5f12.tar.gz
[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>
Diffstat (limited to 'mm')
-rw-r--r--mm/page_alloc.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 637f57f..338a02b 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -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) {
OpenPOWER on IntegriCloud