Commit 293889f5 authored by Linus Torvalds's avatar Linus Torvalds

Waste less memory in dentries.

We don't bother aligining them on a cacheline boundary, since
that is totally excessive in some configurations (especially
P4's with 128-byte cachelines).

Instead, we make the minimum inline string size a bit longer,
and re-order a few fields that allow for better packing on
64-bit architectures, for better memory utilization.
parent 82f1671a
...@@ -1558,14 +1558,11 @@ static void __init dcache_init(unsigned long mempages) ...@@ -1558,14 +1558,11 @@ static void __init dcache_init(unsigned long mempages)
* A constructor could be added for stable state like the lists, * A constructor could be added for stable state like the lists,
* but it is probably not worth it because of the cache nature * but it is probably not worth it because of the cache nature
* of the dcache. * of the dcache.
* If fragmentation is too bad then the SLAB_HWCACHE_ALIGN
* flag could be removed here, to hint to the allocator that
* it should not try to get multiple page regions.
*/ */
dentry_cache = kmem_cache_create("dentry_cache", dentry_cache = kmem_cache_create("dentry_cache",
sizeof(struct dentry), sizeof(struct dentry),
0, 0,
SLAB_HWCACHE_ALIGN|SLAB_RECLAIM_ACCOUNT, SLAB_RECLAIM_ACCOUNT,
NULL, NULL); NULL, NULL);
if (!dentry_cache) if (!dentry_cache)
panic("Cannot create dentry cache"); panic("Cannot create dentry cache");
......
...@@ -74,14 +74,14 @@ full_name_hash(const unsigned char *name, unsigned int len) ...@@ -74,14 +74,14 @@ full_name_hash(const unsigned char *name, unsigned int len)
return end_name_hash(hash); return end_name_hash(hash);
} }
#define DNAME_INLINE_LEN_MIN 16 #define DNAME_INLINE_LEN_MIN 24
struct dcookie_struct; struct dcookie_struct;
struct dentry { struct dentry {
atomic_t d_count; atomic_t d_count;
unsigned long d_vfs_flags; /* moved here to be on same cacheline */
spinlock_t d_lock; /* per dentry lock */ spinlock_t d_lock; /* per dentry lock */
unsigned long d_vfs_flags; /* moved here to be on same cacheline */
struct inode * d_inode; /* Where the name belongs to - NULL is negative */ struct inode * d_inode; /* Where the name belongs to - NULL is negative */
struct list_head d_lru; /* LRU list */ struct list_head d_lru; /* LRU list */
struct list_head d_child; /* child of parent list */ struct list_head d_child; /* child of parent list */
...@@ -102,7 +102,7 @@ struct dentry { ...@@ -102,7 +102,7 @@ struct dentry {
struct hlist_node d_hash; /* lookup hash list */ struct hlist_node d_hash; /* lookup hash list */
struct hlist_head * d_bucket; /* lookup hash bucket */ struct hlist_head * d_bucket; /* lookup hash bucket */
unsigned char d_iname[DNAME_INLINE_LEN_MIN]; /* small names */ unsigned char d_iname[DNAME_INLINE_LEN_MIN]; /* small names */
} ____cacheline_aligned; };
#define DNAME_INLINE_LEN (sizeof(struct dentry)-offsetof(struct dentry,d_iname)) #define DNAME_INLINE_LEN (sizeof(struct dentry)-offsetof(struct dentry,d_iname))
......
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