projects/linux·commit b0196009

[PATCH] cpuset memory spread slab cache hooks

b0196009 · Paul Jackson <[email protected]> · 2006-03-24 03:16:09 -08:00

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 <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
Commit
b0196009d8c3ecf6ea6ec080c63d2ccc146e7ad9
Parents
c61afb18

Changes

4 files changed · +15 −6

FileStatusAddDelContent
fs/buffer.cmodified+5−2View file
fs/dcache.cmodified+2−1View file
fs/inode.cmodified+7−2View file
fs/xfs/linux-2.6/kmem.hmodified+1−1View file

fs/buffer.c

View file
diff --git a/fs/buffer.c b/fs/buffer.c
index 0d6ca7b..36c7253 100644
--- a/fs/buffer.c
+++ b/fs/buffer.c
@@ -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

fs/dcache.c

View file
diff --git a/fs/dcache.c b/fs/dcache.c
index 11dc830..653f64c 100644
--- a/fs/dcache.c
+++ b/fs/dcache.c
@@ -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);

fs/inode.c

View file
diff --git a/fs/inode.c b/fs/inode.c
index 25967b6..a51c671 100644
--- a/fs/inode.c
+++ b/fs/inode.c
@@ -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 */

fs/xfs/linux-2.6/kmem.h

View file
diff --git a/fs/xfs/linux-2.6/kmem.h b/fs/xfs/linux-2.6/kmem.h
index f0268a8..2cfd33d 100644
--- a/fs/xfs/linux-2.6/kmem.h
+++ b/fs/xfs/linux-2.6/kmem.h
@@ -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