Commit 8a98d6d1 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] dentry size tuning

Experimenting with various values of DENTRY_STORAGE

 dentry size      objs/slab   dentry size * objs/slab    inline string

   148               26               3848                   32
   152               26               3952                   36
   156               25               3900                   40
   160               24               4000                   44

We're currently at 160.  The patch fairly arbitrarily takes it down to 152, so
we can fit a 35-char name into the inline part of the dentry.

Also, go back to the old way of sizing d_iname so that any arch-specific
compiler-forced alignemnts are honoured.
parent f7efcc03
......@@ -41,12 +41,7 @@ EXPORT_SYMBOL(dcache_lock);
static kmem_cache_t *dentry_cache;
/*
* The allocation size for each dentry. It is a multiple of 16 bytes. We
* leave the final 32-47 bytes for the inline name.
*/
#define DENTRY_STORAGE (((sizeof(struct dentry)+32) + 15) & ~15)
#define DNAME_INLINE_LEN (DENTRY_STORAGE - sizeof(struct dentry))
#define DNAME_INLINE_LEN (sizeof(struct dentry)-offsetof(struct dentry,d_iname))
/*
* This is the single most critical data structure when it comes
......@@ -1573,7 +1568,7 @@ static void __init dcache_init(unsigned long mempages)
* of the dcache.
*/
dentry_cache = kmem_cache_create("dentry_cache",
DENTRY_STORAGE,
sizeof(struct dentry),
0,
SLAB_RECLAIM_ACCOUNT,
NULL, NULL);
......
......@@ -78,9 +78,8 @@ full_name_hash(const unsigned char *name, unsigned int len)
struct dcookie_struct;
/*
* On x86, dentries are a multiple of 16 bytes, with 16-byte alignment.
*/
#define DNAME_INLINE_LEN_MIN 36
struct dentry {
atomic_t d_count;
unsigned int d_flags; /* protected by d_lock */
......@@ -107,7 +106,7 @@ struct dentry {
struct rcu_head d_rcu;
struct dcookie_struct *d_cookie; /* cookie, if any */
struct hlist_node d_hash; /* lookup hash list */
unsigned char d_iname[0]; /* small names */
unsigned char d_iname[DNAME_INLINE_LEN_MIN]; /* small names */
};
struct dentry_operations {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment