[PATCH] cpuset memory spread slab cache hooks
authorPaul Jackson <pj@sgi.com>
Fri, 24 Mar 2006 11:16:09 +0000 (03:16 -0800)
committerLinus Torvalds <torvalds@g5.osdl.org>
Fri, 24 Mar 2006 15:33:23 +0000 (07:33 -0800)
Change the kmem_cache_create calls for certain slab caches to support cpuset
memory spreading.

See the previous patches, cpuset_mem_spread, for an explanation of cpuset
memory spreading, and cpuset_mem_spread_slab_cache for the slab cache support
for memory spreading.

The slab caches marked for now are: dentry_cache, inode_cache, some xfs slab
caches, and buffer_head.  This list may change over time.  In particular,
other file system types that are used extensively on large NUMA systems may
want to allow for spreading their directory and inode slab cache entries.

Signed-off-by: Paul Jackson <pj@sgi.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
fs/buffer.c
fs/dcache.c
fs/inode.c
fs/xfs/linux-2.6/kmem.h

index 0d6ca7bac6c8b9af3e77bd8cd5dc953992592419..36c7253bea725a08e7443e9498e9265be4451cde 100644 (file)
@@ -3143,8 +3143,11 @@ void __init buffer_init(void)
        int nrpages;
 
        bh_cachep = kmem_cache_create("buffer_head",
-                       sizeof(struct buffer_head), 0,
-                       SLAB_RECLAIM_ACCOUNT|SLAB_PANIC, init_buffer_head, NULL);
+                                       sizeof(struct buffer_head), 0,
+                                       (SLAB_RECLAIM_ACCOUNT|SLAB_PANIC|
+                                       SLAB_MEM_SPREAD),
+                                       init_buffer_head,
+                                       NULL);
 
        /*
         * Limit the bh occupancy to 10% of ZONE_NORMAL
index 11dc83092d4aa48c78650f6dee4b48b834d25d7e..653f64ce98e2e8d482b23af9ece78f6f62352d40 100644 (file)
@@ -1682,7 +1682,8 @@ static void __init dcache_init(unsigned long mempages)
        dentry_cache = kmem_cache_create("dentry_cache",
                                         sizeof(struct dentry),
                                         0,
-                                        SLAB_RECLAIM_ACCOUNT|SLAB_PANIC,
+                                        (SLAB_RECLAIM_ACCOUNT|SLAB_PANIC|
+                                        SLAB_MEM_SPREAD),
                                         NULL, NULL);
        
        set_shrinker(DEFAULT_SEEKS, shrink_dcache_memory);
index 25967b67903d791a6bae24f4dc2c20d57023f65d..a51c671c54cfce57c702651450269fef1b1d7c0e 100644 (file)
@@ -1375,8 +1375,13 @@ void __init inode_init(unsigned long mempages)
        int loop;
 
        /* inode slab cache */
-       inode_cachep = kmem_cache_create("inode_cache", sizeof(struct inode),
-                               0, SLAB_RECLAIM_ACCOUNT|SLAB_PANIC, init_once, NULL);
+       inode_cachep = kmem_cache_create("inode_cache",
+                                        sizeof(struct inode),
+                                        0,
+                                        (SLAB_RECLAIM_ACCOUNT|SLAB_PANIC|
+                                        SLAB_MEM_SPREAD),
+                                        init_once,
+                                        NULL);
        set_shrinker(DEFAULT_SEEKS, shrink_icache_memory);
 
        /* Hash may have been set up in inode_init_early */
index f0268a84e6fd8dcb38b2cbf1bf3b3792a54563b8..2cfd33d4d8aa8af49ca03c0afd9ead31c96a71c3 100644 (file)
@@ -100,7 +100,7 @@ extern void  kmem_free(void *, size_t);
 
 #define KM_ZONE_HWALIGN        SLAB_HWCACHE_ALIGN
 #define KM_ZONE_RECLAIM        SLAB_RECLAIM_ACCOUNT
-#define KM_ZONE_SPREAD 0
+#define KM_ZONE_SPREAD SLAB_MEM_SPREAD
 
 #define kmem_zone      kmem_cache
 #define kmem_zone_t    struct kmem_cache