From: Andrew Morton <akpm@osdl.org>
To: "Chen, Kenneth W" <kenneth.w.chen@intel.com>
Cc: linux-kernel@vger.kernel.org, linux-ia64@vger.kernel.org
Subject: Re: Limit hash table size
Date: Tue, 17 Feb 2004 23:24:51 +0000 [thread overview]
Message-ID: <20040217152451.7e1796d9.akpm@osdl.org> (raw)
In-Reply-To: <B05667366EE6204181EABE9C1B1C0EB501F2AADF@scsmsx401.sc.intel.com>
"Chen, Kenneth W" <kenneth.w.chen@intel.com> wrote:
>
> OK, here is another revision on top of what has been discussed. It adds
> 4 boot time parameters so user can override default size as needed to
> suite special needs.
You've set the default to 2M entries, with an option for this to be
increased via a boot parameter. This means that people whose machines have
lots of memory and a sane number of zones may suddenly wonder why their
app-which-uses-a-zillion-files is running like crap.
I think it would be better to leave things as they are, with a boot option
to scale the tables down. The below patch addresses the inode and dentry
caches. Need to think a bit more about the networking ones.
> I will sent a separate patch for
> kernel-parameters.txt if everyone is OK with this one.
Yes please.
diff -puN fs/dcache.c~limit-hash-table-sizes-boot-options-restore-defaults fs/dcache.c
--- 25/fs/dcache.c~limit-hash-table-sizes-boot-options-restore-defaults Tue Feb 17 15:11:09 2004
+++ 25-akpm/fs/dcache.c Tue Feb 17 15:11:29 2004
@@ -49,7 +49,6 @@ static kmem_cache_t *dentry_cache;
*/
#define D_HASHBITS d_hash_shift
#define D_HASHMASK d_hash_mask
-#define D_HASHMAX (2*1024*1024UL) /* max number of entries */
static unsigned int d_hash_mask;
static unsigned int d_hash_shift;
@@ -1567,12 +1566,11 @@ static void __init dcache_init(unsigned
set_shrinker(DEFAULT_SEEKS, shrink_dcache_memory);
- if (!dhash_entries) {
+ if (!dhash_entries)
dhash_entries = PAGE_SHIFT < 13 ?
mempages >> (13 - PAGE_SHIFT) :
mempages << (PAGE_SHIFT - 13);
- dhash_entries = min(D_HASHMAX, dhash_entries);
- }
+
dhash_entries *= sizeof(struct hlist_head);
for (order = 0; ((1UL << order) << PAGE_SHIFT) < dhash_entries; order++)
;
diff -puN fs/inode.c~limit-hash-table-sizes-boot-options-restore-defaults fs/inode.c
--- 25/fs/inode.c~limit-hash-table-sizes-boot-options-restore-defaults Tue Feb 17 15:11:09 2004
+++ 25-akpm/fs/inode.c Tue Feb 17 15:11:47 2004
@@ -53,7 +53,6 @@
*/
#define I_HASHBITS i_hash_shift
#define I_HASHMASK i_hash_mask
-#define I_HASHMAX (2*1024*1024UL) /* max number of entries */
static unsigned int i_hash_mask;
static unsigned int i_hash_shift;
@@ -1336,12 +1335,11 @@ void __init inode_init(unsigned long mem
for (i = 0; i < ARRAY_SIZE(i_wait_queue_heads); i++)
init_waitqueue_head(&i_wait_queue_heads[i].wqh);
- if (!ihash_entries) {
+ if (!ihash_entries)
ihash_entries = PAGE_SHIFT < 14 ?
mempages >> (14 - PAGE_SHIFT) :
mempages << (PAGE_SHIFT - 14);
- ihash_entries = min(I_HASHMAX, ihash_entries);
- }
+
ihash_entries *= sizeof(struct hlist_head);
for (order = 0; ((1UL << order) << PAGE_SHIFT) < ihash_entries; order++)
;
next prev parent reply other threads:[~2004-02-17 23:24 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-01-08 23:12 Limit hash table size Chen, Kenneth W
2004-01-09 9:25 ` Andrew Morton
2004-01-09 14:25 ` Anton Blanchard
2004-01-09 19:05 ` Chen, Kenneth W
2004-01-12 13:32 ` Anton Blanchard
2004-01-14 22:29 ` Chen, Kenneth W
2004-01-14 22:31 ` Chen, Kenneth W
2004-01-18 14:25 ` Anton Blanchard
2004-02-05 23:58 ` Andrew Morton
2004-02-06 0:10 ` Chen, Kenneth W
2004-02-06 0:23 ` Andrew Morton
2004-02-09 23:12 ` Jes Sorensen
2004-02-17 22:24 ` Chen, Kenneth W
2004-02-17 23:24 ` Andrew Morton [this message]
2004-02-18 0:16 ` Chen, Kenneth W
2004-02-18 0:45 ` Chen, Kenneth W
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=20040217152451.7e1796d9.akpm@osdl.org \
--to=akpm@osdl.org \
--cc=kenneth.w.chen@intel.com \
--cc=linux-ia64@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/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