From: Dimitri Sivanich <sivanich@sgi•com>
To: Al Viro <viro@ZenIV•linux.org.uk>
Cc: linux-kernel@vger•kernel.org,
"David S. Miller" <davem@davemloft•net>,
Alexey Kuznetsov <kuznet@ms2•inr.ac.ru>,
James Morris <jmorris@namei•org>,
Hideaki YOSHIFUJI <yoshfuji@linux-ipv6•org>,
Patrick McHardy <kaber@trash•net>,
"Paul E. McKenney" <paulmck@linux•vnet.ibm.com>,
Paul Gortmaker <paul.gortmaker@windriver•com>,
Andrew Morton <akpm@linux-foundation•org>,
Jiri Kosina <jkosina@suse•cz>, Avi Kivity <avi@redhat•com>,
linux-fsdevel@vger•kernel.org, netdev@vger•kernel.org
Subject: Re: [PATCH] Fix panic in __d_lookup with high dentry hashtable counts
Date: Fri, 13 Jan 2012 10:36:42 -0600 [thread overview]
Message-ID: <20120113163642.GB25788@sgi.com> (raw)
In-Reply-To: <20120113162236.GK23916@ZenIV.linux.org.uk>
On Fri, Jan 13, 2012 at 04:22:36PM +0000, Al Viro wrote:
> On Fri, Jan 13, 2012 at 09:52:37AM -0600, Dimitri Sivanich wrote:
> > When the number of dentry cache hash table entries gets too high
> > (2147483648 entries), use of a signed integer in the initialization
> > loop prevents the dentry_hashtable from getting initialized, resulting
> > in a panic in __d_lookup. Fixing this in dcache_init and a few other
> > spots for consistency.
>
> > static void __init dcache_init(void)
> > {
> > - int loop;
> > + long loop;
>
> You've got to be kidding. Note that D_HASHMASK is at most 32bit. Use
> of long here is an overkill and so's 2^31 hash buckets (that's what,
> 16Gb in hash list heads alone? What kind of average chain length do
> you expect, BTW?)
Yes, long might be overkill right now, but the code is all __init time code.
I don't have numbers showing average chain length at this point, I was
simply fixing this one end case
>
> Can alloc_large_system_hash() produce the horrors that large, anyway?
On a 16TB system, alloc_large_system_hash() produces 2^31 hash buckets, yes.
Would simply capping the value in alloc_large_system_hash() be more palatable?
Something like the following?
Index: linux/mm/page_alloc.c
===================================================================
--- linux.orig/mm/page_alloc.c
+++ linux/mm/page_alloc.c
@@ -5257,6 +5257,7 @@ void *__init alloc_large_system_hash(con
if (max == 0) {
max = ((unsigned long long)nr_all_pages << PAGE_SHIFT) >> 4;
do_div(max, bucketsize);
+ max = min(max, 1ULL << 30);
}
if (numentries > max)
next prev parent reply other threads:[~2012-01-13 16:36 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-13 15:52 [PATCH] Fix panic in __d_lookup with high dentry hashtable counts Dimitri Sivanich
2012-01-13 16:15 ` Eric Dumazet
2012-01-13 16:22 ` Al Viro
2012-01-13 16:36 ` Dimitri Sivanich [this message]
2012-01-13 16:39 ` Dimitri Sivanich
2012-01-17 17:13 ` Dimitri Sivanich
2012-01-17 17:22 ` David Miller
2012-01-17 17:41 ` Dimitri Sivanich
2012-01-17 21:05 ` Dimitri Sivanich
2012-01-18 4:57 ` David Miller
2012-01-17 17:25 ` Al Viro
2012-01-17 17:28 ` David Miller
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=20120113163642.GB25788@sgi.com \
--to=sivanich@sgi$(echo .)com \
--cc=akpm@linux-foundation$(echo .)org \
--cc=avi@redhat$(echo .)com \
--cc=davem@davemloft$(echo .)net \
--cc=jkosina@suse$(echo .)cz \
--cc=jmorris@namei$(echo .)org \
--cc=kaber@trash$(echo .)net \
--cc=kuznet@ms2$(echo .)inr.ac.ru \
--cc=linux-fsdevel@vger$(echo .)kernel.org \
--cc=linux-kernel@vger$(echo .)kernel.org \
--cc=netdev@vger$(echo .)kernel.org \
--cc=paul.gortmaker@windriver$(echo .)com \
--cc=paulmck@linux$(echo .)vnet.ibm.com \
--cc=viro@ZenIV$(echo .)linux.org.uk \
--cc=yoshfuji@linux-ipv6$(echo .)org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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