]> git.neil.brown.name Git - history.git/commitdiff
Waste less memory in dentries.
authorLinus Torvalds <torvalds@ppc970.osdl.org>
Sat, 8 May 2004 13:38:51 +0000 (06:38 -0700)
committerLinus Torvalds <torvalds@ppc970.osdl.org>
Sat, 8 May 2004 13:38:51 +0000 (06:38 -0700)
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.

fs/dcache.c
include/linux/dcache.h

index 4807b82cb0dc083b24effc921999091d441b43b8..d4fa197bd613a651e8752542d5760dda571d413f 100644 (file)
@@ -1558,14 +1558,11 @@ static void __init dcache_init(unsigned long mempages)
         * A constructor could be added for stable state like the lists,
         * but it is probably not worth it because of the cache nature
         * 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",
                                         sizeof(struct dentry),
                                         0,
-                                        SLAB_HWCACHE_ALIGN|SLAB_RECLAIM_ACCOUNT,
+                                        SLAB_RECLAIM_ACCOUNT,
                                         NULL, NULL);
        if (!dentry_cache)
                panic("Cannot create dentry cache");
index 6b2ea8fecf0608233a5f85b87c1646b21c25c8d4..74f22a171e19c4cdcf774e385f0654b3a15e08e7 100644 (file)
@@ -74,14 +74,14 @@ full_name_hash(const unsigned char *name, unsigned int len)
        return end_name_hash(hash);
 }
 
-#define DNAME_INLINE_LEN_MIN 16
+#define DNAME_INLINE_LEN_MIN 24
 
 struct dcookie_struct;
  
 struct dentry {
        atomic_t d_count;
-       unsigned long d_vfs_flags;      /* moved here to be on same cacheline */
        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 list_head d_lru;         /* LRU list */
        struct list_head d_child;       /* child of parent list */
@@ -102,7 +102,7 @@ struct dentry {
        struct hlist_node d_hash;       /* lookup hash list */  
        struct hlist_head * d_bucket;   /* lookup hash bucket */
        unsigned char d_iname[DNAME_INLINE_LEN_MIN]; /* small names */
-} ____cacheline_aligned;
+};
 
 #define DNAME_INLINE_LEN       (sizeof(struct dentry)-offsetof(struct dentry,d_iname))