Commit 6f333c22 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] mark shrinkable slabs as being reclaimable

All slabs which can be reclaimed via VM presure are marked as being
shrinkable, so the core slab code will keep count of their pages.

Except for the one in XFS.  It has strange wrapper stuff.
parent 8f542f30
......@@ -234,7 +234,7 @@ static int init_inodecache(void)
{
adfs_inode_cachep = kmem_cache_create("adfs_inode_cache",
sizeof(struct adfs_inode_info),
0, SLAB_HWCACHE_ALIGN,
0, SLAB_HWCACHE_ALIGN|SLAB_RECLAIM_ACCOUNT,
init_once, NULL);
if (adfs_inode_cachep == NULL)
return -ENOMEM;
......
......@@ -115,7 +115,7 @@ static int init_inodecache(void)
{
affs_inode_cachep = kmem_cache_create("affs_inode_cache",
sizeof(struct affs_inode_info),
0, SLAB_HWCACHE_ALIGN,
0, SLAB_HWCACHE_ALIGN|SLAB_RECLAIM_ACCOUNT,
init_once, NULL);
if (affs_inode_cachep == NULL)
return -ENOMEM;
......
......@@ -81,7 +81,7 @@ int __init afs_fs_init(void)
afs_inode_cachep = kmem_cache_create("afs_inode_cache",
sizeof(afs_vnode_t),
0,
SLAB_HWCACHE_ALIGN,
SLAB_HWCACHE_ALIGN|SLAB_RECLAIM_ACCOUNT,
afs_i_init_once,
NULL);
if (!afs_inode_cachep) {
......
......@@ -430,7 +430,7 @@ befs_init_inodecache(void)
{
befs_inode_cachep = kmem_cache_create("befs_inode_cache",
sizeof (struct befs_inode_info),
0, SLAB_HWCACHE_ALIGN,
0, SLAB_HWCACHE_ALIGN|SLAB_RECLAIM_ACCOUNT,
init_once, NULL);
if (befs_inode_cachep == NULL) {
printk(KERN_ERR "befs_init_inodecache: "
......
......@@ -243,7 +243,7 @@ static int init_inodecache(void)
{
bfs_inode_cachep = kmem_cache_create("bfs_inode_cache",
sizeof(struct bfs_inode_info),
0, SLAB_HWCACHE_ALIGN,
0, SLAB_HWCACHE_ALIGN|SLAB_RECLAIM_ACCOUNT,
init_once, NULL);
if (bfs_inode_cachep == NULL)
return -ENOMEM;
......
......@@ -359,7 +359,7 @@ cifs_init_inodecache(void)
{
cifs_inode_cachep = kmem_cache_create("cifs_inode_cache",
sizeof (struct cifsInodeInfo),
0, SLAB_HWCACHE_ALIGN,
0, SLAB_HWCACHE_ALIGN|SLAB_RECLAIM_ACCOUNT,
cifs_init_once, NULL);
if (cifs_inode_cachep == NULL)
return -ENOMEM;
......
......@@ -70,7 +70,7 @@ int coda_init_inodecache(void)
{
coda_inode_cachep = kmem_cache_create("coda_inode_cache",
sizeof(struct coda_inode_info),
0, SLAB_HWCACHE_ALIGN,
0, SLAB_HWCACHE_ALIGN||SLAB_RECLAIM_ACCOUNT,
init_once, NULL);
if (coda_inode_cachep == NULL)
return -ENOMEM;
......
......@@ -1552,7 +1552,7 @@ static void __init dcache_init(unsigned long mempages)
dentry_cache = kmem_cache_create("dentry_cache",
sizeof(struct dentry),
0,
SLAB_HWCACHE_ALIGN,
SLAB_HWCACHE_ALIGN|SLAB_RECLAIM_ACCOUNT,
NULL, NULL);
if (!dentry_cache)
panic("Cannot create dentry cache");
......
......@@ -1383,7 +1383,7 @@ static int __init dquot_init(void)
dquot_cachep = kmem_cache_create("dquot",
sizeof(struct dquot), sizeof(unsigned long) * 4,
SLAB_HWCACHE_ALIGN, NULL, NULL);
SLAB_HWCACHE_ALIGN|SLAB_RECLAIM_ACCOUNT, NULL, NULL);
if (!dquot_cachep)
panic("Cannot create dquot SLAB cache");
......
......@@ -58,7 +58,7 @@ static int init_inodecache(void)
{
efs_inode_cachep = kmem_cache_create("efs_inode_cache",
sizeof(struct efs_inode_info),
0, SLAB_HWCACHE_ALIGN,
0, SLAB_HWCACHE_ALIGN||SLAB_RECLAIM_ACCOUNT,
init_once, NULL);
if (efs_inode_cachep == NULL)
return -ENOMEM;
......
......@@ -185,7 +185,7 @@ static int init_inodecache(void)
{
ext2_inode_cachep = kmem_cache_create("ext2_inode_cache",
sizeof(struct ext2_inode_info),
0, SLAB_HWCACHE_ALIGN,
0, SLAB_HWCACHE_ALIGN|SLAB_RECLAIM_ACCOUNT,
init_once, NULL);
if (ext2_inode_cachep == NULL)
return -ENOMEM;
......
......@@ -529,7 +529,7 @@ static int init_inodecache(void)
{
ext3_inode_cachep = kmem_cache_create("ext3_inode_cache",
sizeof(struct ext3_inode_info),
0, SLAB_HWCACHE_ALIGN,
0, SLAB_HWCACHE_ALIGN|SLAB_RECLAIM_ACCOUNT,
init_once, NULL);
if (ext3_inode_cachep == NULL)
return -ENOMEM;
......
......@@ -697,7 +697,7 @@ int __init fat_init_inodecache(void)
{
fat_inode_cachep = kmem_cache_create("fat_inode_cache",
sizeof(struct msdos_inode_info),
0, SLAB_HWCACHE_ALIGN,
0, SLAB_HWCACHE_ALIGN|SLAB_RECLAIM_ACCOUNT,
init_once, NULL);
if (fat_inode_cachep == NULL)
return -ENOMEM;
......
......@@ -247,7 +247,8 @@ static int __init
vxfs_init(void)
{
vxfs_inode_cachep = kmem_cache_create("vxfs_inode",
sizeof(struct vxfs_inode_info), 0, 0, NULL, NULL);
sizeof(struct vxfs_inode_info), 0,
SLAB_RECLAIM_ACCOUNT, NULL, NULL);
if (vxfs_inode_cachep)
return (register_filesystem(&vxfs_fs_type));
return -ENOMEM;
......
......@@ -72,7 +72,7 @@ static int init_inodecache(void)
{
hfs_inode_cachep = kmem_cache_create("hfs_inode_cache",
sizeof(struct hfs_inode_info),
0, SLAB_HWCACHE_ALIGN,
0, SLAB_HWCACHE_ALIGN|SLAB_RECLAIM_ACCOUNT,
init_once, NULL);
if (hfs_inode_cachep == NULL)
return -ENOMEM;
......
......@@ -191,7 +191,7 @@ static int init_inodecache(void)
{
hpfs_inode_cachep = kmem_cache_create("hpfs_inode_cache",
sizeof(struct hpfs_inode_info),
0, SLAB_HWCACHE_ALIGN,
0, SLAB_HWCACHE_ALIGN|SLAB_RECLAIM_ACCOUNT,
init_once, NULL);
if (hpfs_inode_cachep == NULL)
return -ENOMEM;
......
......@@ -105,7 +105,7 @@ static int init_inodecache(void)
{
isofs_inode_cachep = kmem_cache_create("isofs_inode_cache",
sizeof(struct iso_inode_info),
0, SLAB_HWCACHE_ALIGN,
0, SLAB_HWCACHE_ALIGN|SLAB_RECLAIM_ACCOUNT,
init_once, NULL);
if (isofs_inode_cachep == NULL)
return -ENOMEM;
......
......@@ -1806,9 +1806,11 @@ init_jffs_fs(void)
jffs_proc_root = proc_mkdir("jffs", proc_root_fs);
#endif
fm_cache = kmem_cache_create("jffs_fm", sizeof(struct jffs_fm),
0, SLAB_HWCACHE_ALIGN, NULL, NULL);
0, SLAB_HWCACHE_ALIGN|SLAB_RECLAIM_ACCOUNT,
NULL, NULL);
node_cache = kmem_cache_create("jffs_node",sizeof(struct jffs_node),
0, SLAB_HWCACHE_ALIGN, NULL, NULL);
0, SLAB_HWCACHE_ALIGN|SLAB_RECLAIM_ACCOUNT,
NULL, NULL);
return register_filesystem(&jffs_fs_type);
}
......
......@@ -73,7 +73,8 @@ int __init jffs2_create_slab_caches(void)
inode_cache_slab = kmem_cache_create("jffs2_inode_cache",
sizeof(struct jffs2_inode_cache),
0, JFFS2_SLAB_POISON, NULL, NULL);
0, JFFS2_SLAB_POISON|SLAB_RECLAIM_ACCOUNT,
NULL, NULL);
if (inode_cache_slab)
return 0;
err:
......
......@@ -299,7 +299,7 @@ static int __init init_jffs2_fs(void)
jffs2_inode_cachep = kmem_cache_create("jffs2_i",
sizeof(struct jffs2_inode_info),
0, SLAB_HWCACHE_ALIGN,
0, SLAB_HWCACHE_ALIGN|SLAB_RECLAIM_ACCOUNT,
jffs2_i_init_once, NULL);
if (!jffs2_inode_cachep) {
printk(KERN_ERR "JFFS2 error: Failed to initialise inode cache\n");
......
......@@ -444,8 +444,8 @@ static int __init init_jfs_fs(void)
int rc;
jfs_inode_cachep =
kmem_cache_create("jfs_ip", sizeof(struct jfs_inode_info), 0, 0,
init_once, NULL);
kmem_cache_create("jfs_ip", sizeof(struct jfs_inode_info), 0,
SLAB_RECLAIM_ACCOUNT, init_once, NULL);
if (jfs_inode_cachep == NULL)
return -ENOMEM;
......
......@@ -265,7 +265,7 @@ mb_cache_create(const char *name, struct mb_cache_op *cache_op,
INIT_LIST_HEAD(&cache->c_indexes_hash[m][n]);
}
cache->c_entry_cache = kmem_cache_create(name, entry_size, 0,
0 /*SLAB_POISON | SLAB_RED_ZONE*/, NULL, NULL);
SLAB_RECLAIM_ACCOUNT, NULL, NULL);
if (!cache->c_entry_cache)
goto fail;
......
......@@ -79,7 +79,7 @@ static int init_inodecache(void)
{
minix_inode_cachep = kmem_cache_create("minix_inode_cache",
sizeof(struct minix_inode_info),
0, SLAB_HWCACHE_ALIGN,
0, SLAB_HWCACHE_ALIGN|SLAB_RECLAIM_ACCOUNT,
init_once, NULL);
if (minix_inode_cachep == NULL)
return -ENOMEM;
......
......@@ -72,7 +72,7 @@ static int init_inodecache(void)
{
ncp_inode_cachep = kmem_cache_create("ncp_inode_cache",
sizeof(struct ncp_inode_info),
0, SLAB_HWCACHE_ALIGN,
0, SLAB_HWCACHE_ALIGN|SLAB_RECLAIM_ACCOUNT,
init_once, NULL);
if (ncp_inode_cachep == NULL)
return -ENOMEM;
......
......@@ -1571,7 +1571,7 @@ int nfs_init_inodecache(void)
{
nfs_inode_cachep = kmem_cache_create("nfs_inode_cache",
sizeof(struct nfs_inode),
0, SLAB_HWCACHE_ALIGN,
0, SLAB_HWCACHE_ALIGN|SLAB_RECLAIM_ACCOUNT,
init_once, NULL);
if (nfs_inode_cachep == NULL)
return -ENOMEM;
......
......@@ -1715,7 +1715,8 @@ static int __init init_ntfs_fs(void)
}
ntfs_inode_cache = kmem_cache_create(ntfs_inode_cache_name,
sizeof(ntfs_inode), 0, SLAB_HWCACHE_ALIGN, NULL, NULL);
sizeof(ntfs_inode), 0,
SLAB_HWCACHE_ALIGN|SLAB_RECLAIM_ACCOUNT, NULL, NULL);
if (!ntfs_inode_cache) {
printk(KERN_CRIT "NTFS: Failed to create %s!\n",
ntfs_inode_cache_name);
......@@ -1723,7 +1724,8 @@ static int __init init_ntfs_fs(void)
}
ntfs_big_inode_cache = kmem_cache_create(ntfs_big_inode_cache_name,
sizeof(big_ntfs_inode), 0, SLAB_HWCACHE_ALIGN,
sizeof(big_ntfs_inode), 0,
SLAB_HWCACHE_ALIGN|SLAB_RECLAIM_ACCOUNT,
ntfs_big_inode_init_once, NULL);
if (!ntfs_big_inode_cache) {
printk(KERN_CRIT "NTFS: Failed to create %s!\n",
......
......@@ -121,7 +121,7 @@ int __init proc_init_inodecache(void)
{
proc_inode_cachep = kmem_cache_create("proc_inode_cache",
sizeof(struct proc_inode),
0, SLAB_HWCACHE_ALIGN,
0, SLAB_HWCACHE_ALIGN|SLAB_RECLAIM_ACCOUNT,
init_once, NULL);
if (proc_inode_cachep == NULL)
return -ENOMEM;
......
......@@ -540,7 +540,7 @@ static int init_inodecache(void)
{
qnx4_inode_cachep = kmem_cache_create("qnx4_inode_cache",
sizeof(struct qnx4_inode_info),
0, SLAB_HWCACHE_ALIGN,
0, SLAB_HWCACHE_ALIGN|SLAB_RECLAIM_ACCOUNT,
init_once, NULL);
if (qnx4_inode_cachep == NULL)
return -ENOMEM;
......
......@@ -440,7 +440,7 @@ static int init_inodecache(void)
{
reiserfs_inode_cachep = kmem_cache_create("reiser_inode_cache",
sizeof(struct reiserfs_inode_info),
0, SLAB_HWCACHE_ALIGN,
0, SLAB_HWCACHE_ALIGN|SLAB_RECLAIM_ACCOUNT,
init_once, NULL);
if (reiserfs_inode_cachep == NULL)
return -ENOMEM;
......
......@@ -578,7 +578,7 @@ static int init_inodecache(void)
{
romfs_inode_cachep = kmem_cache_create("romfs_inode_cache",
sizeof(struct romfs_inode_info),
0, SLAB_HWCACHE_ALIGN,
0, SLAB_HWCACHE_ALIGN|SLAB_RECLAIM_ACCOUNT,
init_once, NULL);
if (romfs_inode_cachep == NULL)
return -ENOMEM;
......
......@@ -79,7 +79,7 @@ static int init_inodecache(void)
{
smb_inode_cachep = kmem_cache_create("smb_inode_cache",
sizeof(struct smb_inode_info),
0, SLAB_HWCACHE_ALIGN,
0, SLAB_HWCACHE_ALIGN|SLAB_RECLAIM_ACCOUNT,
init_once, NULL);
if (smb_inode_cachep == NULL)
return -ENOMEM;
......
......@@ -328,7 +328,8 @@ int __init sysv_init_icache(void)
{
sysv_inode_cachep = kmem_cache_create("sysv_inode_cache",
sizeof(struct sysv_inode_info), 0,
SLAB_HWCACHE_ALIGN, init_once, NULL);
SLAB_HWCACHE_ALIGN|SLAB_RECLAIM_ACCOUNT,
init_once, NULL);
if (!sysv_inode_cachep)
return -ENOMEM;
return 0;
......
......@@ -141,7 +141,7 @@ static int init_inodecache(void)
{
udf_inode_cachep = kmem_cache_create("udf_inode_cache",
sizeof(struct udf_inode_info),
0, SLAB_HWCACHE_ALIGN,
0, SLAB_HWCACHE_ALIGN|SLAB_RECLAIM_ACCOUNT,
init_once, NULL);
if (udf_inode_cachep == NULL)
return -ENOMEM;
......
......@@ -1029,7 +1029,7 @@ static int init_inodecache(void)
{
ufs_inode_cachep = kmem_cache_create("ufs_inode_cache",
sizeof(struct ufs_inode_info),
0, SLAB_HWCACHE_ALIGN,
0, SLAB_HWCACHE_ALIGN|SLAB_RECLAIM_ACCOUNT,
init_once, NULL);
if (ufs_inode_cachep == NULL)
return -ENOMEM;
......
......@@ -329,7 +329,8 @@ STATIC int
init_inodecache( void )
{
linvfs_inode_cachep = kmem_cache_create("linvfs_icache",
sizeof(vnode_t), 0, SLAB_HWCACHE_ALIGN,
sizeof(vnode_t), 0,
SLAB_HWCACHE_ALIGN|SLAB_RECLAIM_ACCOUNT,
init_once, NULL);
if (linvfs_inode_cachep == NULL)
......
......@@ -1744,7 +1744,7 @@ static int init_inodecache(void)
{
shmem_inode_cachep = kmem_cache_create("shmem_inode_cache",
sizeof(struct shmem_inode_info),
0, SLAB_HWCACHE_ALIGN,
0, SLAB_HWCACHE_ALIGN|SLAB_RECLAIM_ACCOUNT,
init_once, NULL);
if (shmem_inode_cachep == NULL)
return -ENOMEM;
......
......@@ -311,7 +311,7 @@ static int init_inodecache(void)
{
sock_inode_cachep = kmem_cache_create("sock_inode_cache",
sizeof(struct socket_alloc),
0, SLAB_HWCACHE_ALIGN,
0, SLAB_HWCACHE_ALIGN|SLAB_RECLAIM_ACCOUNT,
init_once, NULL);
if (sock_inode_cachep == NULL)
return -ENOMEM;
......
......@@ -782,7 +782,7 @@ int register_rpc_pipefs(void)
{
rpc_inode_cachep = kmem_cache_create("rpc_inode_cache",
sizeof(struct rpc_inode),
0, SLAB_HWCACHE_ALIGN,
0, SLAB_HWCACHE_ALIGN|SLAB_RECLAIM_ACCOUNT,
init_once, NULL);
if (!rpc_inode_cachep)
return -ENOMEM;
......
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