From: hawkes@sgi.com
To: Kenneth Chen <kenneth.w.chen@intel.com>,
Andrew Morton <akpm@osdl.org>,
linux-kernel@vger.kernel.org
Cc: Jack Steiner <steiner@sgi.com>,
hawkes@sgi.com, Jes Sorensen <jes@sgi.com>
Subject: [PATCH] fix alloc_large_system_hash roundup
Date: Wed, 15 Mar 2006 09:36:39 -0800 [thread overview]
Message-ID: <20060315173639.11102.71657.sendpatchset@tomahawk.engr.sgi.com> (raw)
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>
Index: linux/mm/page_alloc.c
===================================================================
--- linux.orig/mm/page_alloc.c 2006-03-14 15:25:40.000000000 -0800
+++ linux/mm/page_alloc.c 2006-03-14 16:06:48.000000000 -0800
@@ -2686,7 +2686,7 @@ void *__init alloc_large_system_hash(con
numentries <<= (PAGE_SHIFT - scale);
}
/* rounded up to nearest power of 2 in size */
- numentries = 1UL << (long_log2(numentries) + 1);
+ numentries = 1UL << (long_log2(2*numentries - 1));
/* limit allocation size to 1/16 total memory by default */
if (max == 0) {
next reply other threads:[~2006-03-15 17:37 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-03-15 17:36 hawkes [this message]
2006-03-15 17:40 ` Roland Dreier
2006-03-15 18:29 ` Chen, Kenneth W
2006-03-15 18:41 ` Roland Dreier
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20060315173639.11102.71657.sendpatchset@tomahawk.engr.sgi.com \
--to=hawkes@sgi.com \
--cc=akpm@osdl.org \
--cc=jes@sgi.com \
--cc=kenneth.w.chen@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=steiner@sgi.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®