Commit 5d097056 authored by Vladimir Davydov's avatar Vladimir Davydov Committed by Linus Torvalds

kmemcg: account certain kmem allocations to memcg

Mark those kmem allocations that are known to be easily triggered from
userspace as __GFP_ACCOUNT/SLAB_ACCOUNT, which makes them accounted to
memcg.  For the list, see below:

 - threadinfo
 - task_struct
 - task_delay_info
 - pid
 - cred
 - mm_struct
 - vm_area_struct and vm_region (nommu)
 - anon_vma and anon_vma_chain
 - signal_struct
 - sighand_struct
 - fs_struct
 - files_struct
 - fdtable and fdtable->full_fds_bits
 - dentry and external_name
 - inode for all filesystems. This is the most tedious part, because
   most filesystems overwrite the alloc_inode method.

The list is far from complete, so feel free to add more objects.
Nevertheless, it should be close to "account everything" approach and
keep most workloads within bounds.  Malevolent users will be able to
breach the limit, but this was possible even with the former "account
everything" approach (simply because it did not account everything in
fact).

[akpm@linux-foundation.org: coding-style fixes]
Signed-off-by: default avatarVladimir Davydov <vdavydov@virtuozzo.com>
Acked-by: default avatarJohannes Weiner <hannes@cmpxchg.org>
Acked-by: default avatarMichal Hocko <mhocko@suse.com>
Cc: Tejun Heo <tj@kernel.org>
Cc: Greg Thelen <gthelen@google.com>
Cc: Christoph Lameter <cl@linux.com>
Cc: Pekka Enberg <penberg@kernel.org>
Cc: David Rientjes <rientjes@google.com>
Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 37f08dda
...@@ -767,7 +767,7 @@ static int __init spufs_init(void) ...@@ -767,7 +767,7 @@ static int __init spufs_init(void)
ret = -ENOMEM; ret = -ENOMEM;
spufs_inode_cache = kmem_cache_create("spufs_inode_cache", spufs_inode_cache = kmem_cache_create("spufs_inode_cache",
sizeof(struct spufs_inode_info), 0, sizeof(struct spufs_inode_info), 0,
SLAB_HWCACHE_ALIGN, spufs_init_once); SLAB_HWCACHE_ALIGN|SLAB_ACCOUNT, spufs_init_once);
if (!spufs_inode_cache) if (!spufs_inode_cache)
goto out; goto out;
......
...@@ -106,7 +106,8 @@ static int __init init_lustre_lite(void) ...@@ -106,7 +106,8 @@ static int __init init_lustre_lite(void)
rc = -ENOMEM; rc = -ENOMEM;
ll_inode_cachep = kmem_cache_create("lustre_inode_cache", ll_inode_cachep = kmem_cache_create("lustre_inode_cache",
sizeof(struct ll_inode_info), sizeof(struct ll_inode_info),
0, SLAB_HWCACHE_ALIGN, NULL); 0, SLAB_HWCACHE_ALIGN|SLAB_ACCOUNT,
NULL);
if (ll_inode_cachep == NULL) if (ll_inode_cachep == NULL)
goto out_cache; goto out_cache;
......
...@@ -575,7 +575,7 @@ static int v9fs_init_inode_cache(void) ...@@ -575,7 +575,7 @@ static int v9fs_init_inode_cache(void)
v9fs_inode_cache = kmem_cache_create("v9fs_inode_cache", v9fs_inode_cache = kmem_cache_create("v9fs_inode_cache",
sizeof(struct v9fs_inode), sizeof(struct v9fs_inode),
0, (SLAB_RECLAIM_ACCOUNT| 0, (SLAB_RECLAIM_ACCOUNT|
SLAB_MEM_SPREAD), SLAB_MEM_SPREAD|SLAB_ACCOUNT),
v9fs_inode_init_once); v9fs_inode_init_once);
if (!v9fs_inode_cache) if (!v9fs_inode_cache)
return -ENOMEM; return -ENOMEM;
......
...@@ -271,7 +271,7 @@ static int __init init_inodecache(void) ...@@ -271,7 +271,7 @@ static int __init init_inodecache(void)
adfs_inode_cachep = kmem_cache_create("adfs_inode_cache", adfs_inode_cachep = kmem_cache_create("adfs_inode_cache",
sizeof(struct adfs_inode_info), sizeof(struct adfs_inode_info),
0, (SLAB_RECLAIM_ACCOUNT| 0, (SLAB_RECLAIM_ACCOUNT|
SLAB_MEM_SPREAD), SLAB_MEM_SPREAD|SLAB_ACCOUNT),
init_once); init_once);
if (adfs_inode_cachep == NULL) if (adfs_inode_cachep == NULL)
return -ENOMEM; return -ENOMEM;
......
...@@ -132,7 +132,7 @@ static int __init init_inodecache(void) ...@@ -132,7 +132,7 @@ static int __init init_inodecache(void)
affs_inode_cachep = kmem_cache_create("affs_inode_cache", affs_inode_cachep = kmem_cache_create("affs_inode_cache",
sizeof(struct affs_inode_info), sizeof(struct affs_inode_info),
0, (SLAB_RECLAIM_ACCOUNT| 0, (SLAB_RECLAIM_ACCOUNT|
SLAB_MEM_SPREAD), SLAB_MEM_SPREAD|SLAB_ACCOUNT),
init_once); init_once);
if (affs_inode_cachep == NULL) if (affs_inode_cachep == NULL)
return -ENOMEM; return -ENOMEM;
......
...@@ -91,7 +91,7 @@ int __init afs_fs_init(void) ...@@ -91,7 +91,7 @@ int __init afs_fs_init(void)
afs_inode_cachep = kmem_cache_create("afs_inode_cache", afs_inode_cachep = kmem_cache_create("afs_inode_cache",
sizeof(struct afs_vnode), sizeof(struct afs_vnode),
0, 0,
SLAB_HWCACHE_ALIGN, SLAB_HWCACHE_ALIGN|SLAB_ACCOUNT,
afs_i_init_once); afs_i_init_once);
if (!afs_inode_cachep) { if (!afs_inode_cachep) {
printk(KERN_NOTICE "kAFS: Failed to allocate inode cache\n"); printk(KERN_NOTICE "kAFS: Failed to allocate inode cache\n");
......
...@@ -434,7 +434,7 @@ befs_init_inodecache(void) ...@@ -434,7 +434,7 @@ befs_init_inodecache(void)
befs_inode_cachep = kmem_cache_create("befs_inode_cache", befs_inode_cachep = kmem_cache_create("befs_inode_cache",
sizeof (struct befs_inode_info), sizeof (struct befs_inode_info),
0, (SLAB_RECLAIM_ACCOUNT| 0, (SLAB_RECLAIM_ACCOUNT|
SLAB_MEM_SPREAD), SLAB_MEM_SPREAD|SLAB_ACCOUNT),
init_once); init_once);
if (befs_inode_cachep == NULL) { if (befs_inode_cachep == NULL) {
pr_err("%s: Couldn't initialize inode slabcache\n", __func__); pr_err("%s: Couldn't initialize inode slabcache\n", __func__);
......
...@@ -270,7 +270,7 @@ static int __init init_inodecache(void) ...@@ -270,7 +270,7 @@ static int __init init_inodecache(void)
bfs_inode_cachep = kmem_cache_create("bfs_inode_cache", bfs_inode_cachep = kmem_cache_create("bfs_inode_cache",
sizeof(struct bfs_inode_info), sizeof(struct bfs_inode_info),
0, (SLAB_RECLAIM_ACCOUNT| 0, (SLAB_RECLAIM_ACCOUNT|
SLAB_MEM_SPREAD), SLAB_MEM_SPREAD|SLAB_ACCOUNT),
init_once); init_once);
if (bfs_inode_cachep == NULL) if (bfs_inode_cachep == NULL)
return -ENOMEM; return -ENOMEM;
......
...@@ -595,7 +595,7 @@ void __init bdev_cache_init(void) ...@@ -595,7 +595,7 @@ void __init bdev_cache_init(void)
bdev_cachep = kmem_cache_create("bdev_cache", sizeof(struct bdev_inode), bdev_cachep = kmem_cache_create("bdev_cache", sizeof(struct bdev_inode),
0, (SLAB_HWCACHE_ALIGN|SLAB_RECLAIM_ACCOUNT| 0, (SLAB_HWCACHE_ALIGN|SLAB_RECLAIM_ACCOUNT|
SLAB_MEM_SPREAD|SLAB_PANIC), SLAB_MEM_SPREAD|SLAB_ACCOUNT|SLAB_PANIC),
init_once); init_once);
err = register_filesystem(&bd_type); err = register_filesystem(&bd_type);
if (err) if (err)
......
...@@ -9161,7 +9161,8 @@ int btrfs_init_cachep(void) ...@@ -9161,7 +9161,8 @@ int btrfs_init_cachep(void)
{ {
btrfs_inode_cachep = kmem_cache_create("btrfs_inode", btrfs_inode_cachep = kmem_cache_create("btrfs_inode",
sizeof(struct btrfs_inode), 0, sizeof(struct btrfs_inode), 0,
SLAB_RECLAIM_ACCOUNT | SLAB_MEM_SPREAD, init_once); SLAB_RECLAIM_ACCOUNT | SLAB_MEM_SPREAD | SLAB_ACCOUNT,
init_once);
if (!btrfs_inode_cachep) if (!btrfs_inode_cachep)
goto fail; goto fail;
......
...@@ -639,8 +639,8 @@ static int __init init_caches(void) ...@@ -639,8 +639,8 @@ static int __init init_caches(void)
ceph_inode_cachep = kmem_cache_create("ceph_inode_info", ceph_inode_cachep = kmem_cache_create("ceph_inode_info",
sizeof(struct ceph_inode_info), sizeof(struct ceph_inode_info),
__alignof__(struct ceph_inode_info), __alignof__(struct ceph_inode_info),
(SLAB_RECLAIM_ACCOUNT|SLAB_MEM_SPREAD), SLAB_RECLAIM_ACCOUNT|SLAB_MEM_SPREAD|
ceph_inode_init_once); SLAB_ACCOUNT, ceph_inode_init_once);
if (ceph_inode_cachep == NULL) if (ceph_inode_cachep == NULL)
return -ENOMEM; return -ENOMEM;
......
...@@ -1092,7 +1092,7 @@ cifs_init_inodecache(void) ...@@ -1092,7 +1092,7 @@ cifs_init_inodecache(void)
cifs_inode_cachep = kmem_cache_create("cifs_inode_cache", cifs_inode_cachep = kmem_cache_create("cifs_inode_cache",
sizeof(struct cifsInodeInfo), sizeof(struct cifsInodeInfo),
0, (SLAB_RECLAIM_ACCOUNT| 0, (SLAB_RECLAIM_ACCOUNT|
SLAB_MEM_SPREAD), SLAB_MEM_SPREAD|SLAB_ACCOUNT),
cifs_init_once); cifs_init_once);
if (cifs_inode_cachep == NULL) if (cifs_inode_cachep == NULL)
return -ENOMEM; return -ENOMEM;
......
...@@ -74,9 +74,9 @@ static void init_once(void *foo) ...@@ -74,9 +74,9 @@ static void init_once(void *foo)
int __init coda_init_inodecache(void) int __init coda_init_inodecache(void)
{ {
coda_inode_cachep = kmem_cache_create("coda_inode_cache", coda_inode_cachep = kmem_cache_create("coda_inode_cache",
sizeof(struct coda_inode_info), sizeof(struct coda_inode_info), 0,
0, SLAB_RECLAIM_ACCOUNT|SLAB_MEM_SPREAD, SLAB_RECLAIM_ACCOUNT|SLAB_MEM_SPREAD|
init_once); SLAB_ACCOUNT, init_once);
if (coda_inode_cachep == NULL) if (coda_inode_cachep == NULL)
return -ENOMEM; return -ENOMEM;
return 0; return 0;
......
...@@ -1571,7 +1571,8 @@ struct dentry *__d_alloc(struct super_block *sb, const struct qstr *name) ...@@ -1571,7 +1571,8 @@ struct dentry *__d_alloc(struct super_block *sb, const struct qstr *name)
dentry->d_iname[DNAME_INLINE_LEN-1] = 0; dentry->d_iname[DNAME_INLINE_LEN-1] = 0;
if (name->len > DNAME_INLINE_LEN-1) { if (name->len > DNAME_INLINE_LEN-1) {
size_t size = offsetof(struct external_name, name[1]); size_t size = offsetof(struct external_name, name[1]);
struct external_name *p = kmalloc(size + name->len, GFP_KERNEL); struct external_name *p = kmalloc(size + name->len,
GFP_KERNEL_ACCOUNT);
if (!p) { if (!p) {
kmem_cache_free(dentry_cache, dentry); kmem_cache_free(dentry_cache, dentry);
return NULL; return NULL;
...@@ -3415,7 +3416,7 @@ static void __init dcache_init(void) ...@@ -3415,7 +3416,7 @@ static void __init dcache_init(void)
* of the dcache. * of the dcache.
*/ */
dentry_cache = KMEM_CACHE(dentry, dentry_cache = KMEM_CACHE(dentry,
SLAB_RECLAIM_ACCOUNT|SLAB_PANIC|SLAB_MEM_SPREAD); SLAB_RECLAIM_ACCOUNT|SLAB_PANIC|SLAB_MEM_SPREAD|SLAB_ACCOUNT);
/* Hash may have been set up in dcache_init_early */ /* Hash may have been set up in dcache_init_early */
if (!hashdist) if (!hashdist)
......
...@@ -663,6 +663,7 @@ static struct ecryptfs_cache_info { ...@@ -663,6 +663,7 @@ static struct ecryptfs_cache_info {
struct kmem_cache **cache; struct kmem_cache **cache;
const char *name; const char *name;
size_t size; size_t size;
unsigned long flags;
void (*ctor)(void *obj); void (*ctor)(void *obj);
} ecryptfs_cache_infos[] = { } ecryptfs_cache_infos[] = {
{ {
...@@ -684,6 +685,7 @@ static struct ecryptfs_cache_info { ...@@ -684,6 +685,7 @@ static struct ecryptfs_cache_info {
.cache = &ecryptfs_inode_info_cache, .cache = &ecryptfs_inode_info_cache,
.name = "ecryptfs_inode_cache", .name = "ecryptfs_inode_cache",
.size = sizeof(struct ecryptfs_inode_info), .size = sizeof(struct ecryptfs_inode_info),
.flags = SLAB_ACCOUNT,
.ctor = inode_info_init_once, .ctor = inode_info_init_once,
}, },
{ {
...@@ -755,8 +757,8 @@ static int ecryptfs_init_kmem_caches(void) ...@@ -755,8 +757,8 @@ static int ecryptfs_init_kmem_caches(void)
struct ecryptfs_cache_info *info; struct ecryptfs_cache_info *info;
info = &ecryptfs_cache_infos[i]; info = &ecryptfs_cache_infos[i];
*(info->cache) = kmem_cache_create(info->name, info->size, *(info->cache) = kmem_cache_create(info->name, info->size, 0,
0, SLAB_HWCACHE_ALIGN, info->ctor); SLAB_HWCACHE_ALIGN | info->flags, info->ctor);
if (!*(info->cache)) { if (!*(info->cache)) {
ecryptfs_free_kmem_caches(); ecryptfs_free_kmem_caches();
ecryptfs_printk(KERN_WARNING, "%s: " ecryptfs_printk(KERN_WARNING, "%s: "
......
...@@ -94,9 +94,9 @@ static void init_once(void *foo) ...@@ -94,9 +94,9 @@ static void init_once(void *foo)
static int __init init_inodecache(void) static int __init init_inodecache(void)
{ {
efs_inode_cachep = kmem_cache_create("efs_inode_cache", efs_inode_cachep = kmem_cache_create("efs_inode_cache",
sizeof(struct efs_inode_info), sizeof(struct efs_inode_info), 0,
0, SLAB_RECLAIM_ACCOUNT|SLAB_MEM_SPREAD, SLAB_RECLAIM_ACCOUNT|SLAB_MEM_SPREAD|
init_once); SLAB_ACCOUNT, init_once);
if (efs_inode_cachep == NULL) if (efs_inode_cachep == NULL)
return -ENOMEM; return -ENOMEM;
return 0; return 0;
......
...@@ -194,8 +194,8 @@ static int init_inodecache(void) ...@@ -194,8 +194,8 @@ static int init_inodecache(void)
{ {
exofs_inode_cachep = kmem_cache_create("exofs_inode_cache", exofs_inode_cachep = kmem_cache_create("exofs_inode_cache",
sizeof(struct exofs_i_info), 0, sizeof(struct exofs_i_info), 0,
SLAB_RECLAIM_ACCOUNT | SLAB_MEM_SPREAD, SLAB_RECLAIM_ACCOUNT | SLAB_MEM_SPREAD |
exofs_init_once); SLAB_ACCOUNT, exofs_init_once);
if (exofs_inode_cachep == NULL) if (exofs_inode_cachep == NULL)
return -ENOMEM; return -ENOMEM;
return 0; return 0;
......
...@@ -203,7 +203,7 @@ static int __init init_inodecache(void) ...@@ -203,7 +203,7 @@ static int __init init_inodecache(void)
ext2_inode_cachep = kmem_cache_create("ext2_inode_cache", ext2_inode_cachep = kmem_cache_create("ext2_inode_cache",
sizeof(struct ext2_inode_info), sizeof(struct ext2_inode_info),
0, (SLAB_RECLAIM_ACCOUNT| 0, (SLAB_RECLAIM_ACCOUNT|
SLAB_MEM_SPREAD), SLAB_MEM_SPREAD|SLAB_ACCOUNT),
init_once); init_once);
if (ext2_inode_cachep == NULL) if (ext2_inode_cachep == NULL)
return -ENOMEM; return -ENOMEM;
......
...@@ -966,7 +966,7 @@ static int __init init_inodecache(void) ...@@ -966,7 +966,7 @@ static int __init init_inodecache(void)
ext4_inode_cachep = kmem_cache_create("ext4_inode_cache", ext4_inode_cachep = kmem_cache_create("ext4_inode_cache",
sizeof(struct ext4_inode_info), sizeof(struct ext4_inode_info),
0, (SLAB_RECLAIM_ACCOUNT| 0, (SLAB_RECLAIM_ACCOUNT|
SLAB_MEM_SPREAD), SLAB_MEM_SPREAD|SLAB_ACCOUNT),
init_once); init_once);
if (ext4_inode_cachep == NULL) if (ext4_inode_cachep == NULL)
return -ENOMEM; return -ENOMEM;
......
...@@ -1541,8 +1541,9 @@ MODULE_ALIAS_FS("f2fs"); ...@@ -1541,8 +1541,9 @@ MODULE_ALIAS_FS("f2fs");
static int __init init_inodecache(void) static int __init init_inodecache(void)
{ {
f2fs_inode_cachep = f2fs_kmem_cache_create("f2fs_inode_cache", f2fs_inode_cachep = kmem_cache_create("f2fs_inode_cache",
sizeof(struct f2fs_inode_info)); sizeof(struct f2fs_inode_info), 0,
SLAB_RECLAIM_ACCOUNT|SLAB_ACCOUNT, NULL);
if (!f2fs_inode_cachep) if (!f2fs_inode_cachep)
return -ENOMEM; return -ENOMEM;
return 0; return 0;
......
...@@ -677,7 +677,7 @@ static int __init fat_init_inodecache(void) ...@@ -677,7 +677,7 @@ static int __init fat_init_inodecache(void)
fat_inode_cachep = kmem_cache_create("fat_inode_cache", fat_inode_cachep = kmem_cache_create("fat_inode_cache",
sizeof(struct msdos_inode_info), sizeof(struct msdos_inode_info),
0, (SLAB_RECLAIM_ACCOUNT| 0, (SLAB_RECLAIM_ACCOUNT|
SLAB_MEM_SPREAD), SLAB_MEM_SPREAD|SLAB_ACCOUNT),
init_once); init_once);
if (fat_inode_cachep == NULL) if (fat_inode_cachep == NULL)
return -ENOMEM; return -ENOMEM;
......
...@@ -37,11 +37,12 @@ static void *alloc_fdmem(size_t size) ...@@ -37,11 +37,12 @@ static void *alloc_fdmem(size_t size)
* vmalloc() if the allocation size will be considered "large" by the VM. * vmalloc() if the allocation size will be considered "large" by the VM.
*/ */
if (size <= (PAGE_SIZE << PAGE_ALLOC_COSTLY_ORDER)) { if (size <= (PAGE_SIZE << PAGE_ALLOC_COSTLY_ORDER)) {
void *data = kmalloc(size, GFP_KERNEL|__GFP_NOWARN|__GFP_NORETRY); void *data = kmalloc(size, GFP_KERNEL_ACCOUNT |
__GFP_NOWARN | __GFP_NORETRY);
if (data != NULL) if (data != NULL)
return data; return data;
} }
return vmalloc(size); return __vmalloc(size, GFP_KERNEL_ACCOUNT | __GFP_HIGHMEM, PAGE_KERNEL);
} }
static void __free_fdtable(struct fdtable *fdt) static void __free_fdtable(struct fdtable *fdt)
...@@ -126,7 +127,7 @@ static struct fdtable * alloc_fdtable(unsigned int nr) ...@@ -126,7 +127,7 @@ static struct fdtable * alloc_fdtable(unsigned int nr)
if (unlikely(nr > sysctl_nr_open)) if (unlikely(nr > sysctl_nr_open))
nr = ((sysctl_nr_open - 1) | (BITS_PER_LONG - 1)) + 1; nr = ((sysctl_nr_open - 1) | (BITS_PER_LONG - 1)) + 1;
fdt = kmalloc(sizeof(struct fdtable), GFP_KERNEL); fdt = kmalloc(sizeof(struct fdtable), GFP_KERNEL_ACCOUNT);
if (!fdt) if (!fdt)
goto out; goto out;
fdt->max_fds = nr; fdt->max_fds = nr;
......
...@@ -1255,8 +1255,8 @@ static int __init fuse_fs_init(void) ...@@ -1255,8 +1255,8 @@ static int __init fuse_fs_init(void)
int err; int err;
fuse_inode_cachep = kmem_cache_create("fuse_inode", fuse_inode_cachep = kmem_cache_create("fuse_inode",
sizeof(struct fuse_inode), sizeof(struct fuse_inode), 0,
0, SLAB_HWCACHE_ALIGN, SLAB_HWCACHE_ALIGN|SLAB_ACCOUNT,
fuse_inode_init_once); fuse_inode_init_once);
err = -ENOMEM; err = -ENOMEM;
if (!fuse_inode_cachep) if (!fuse_inode_cachep)
......
...@@ -114,7 +114,8 @@ static int __init init_gfs2_fs(void) ...@@ -114,7 +114,8 @@ static int __init init_gfs2_fs(void)
gfs2_inode_cachep = kmem_cache_create("gfs2_inode", gfs2_inode_cachep = kmem_cache_create("gfs2_inode",
sizeof(struct gfs2_inode), sizeof(struct gfs2_inode),
0, SLAB_RECLAIM_ACCOUNT| 0, SLAB_RECLAIM_ACCOUNT|
SLAB_MEM_SPREAD, SLAB_MEM_SPREAD|
SLAB_ACCOUNT,
gfs2_init_inode_once); gfs2_init_inode_once);
if (!gfs2_inode_cachep) if (!gfs2_inode_cachep)
goto fail; goto fail;
......
...@@ -483,8 +483,8 @@ static int __init init_hfs_fs(void) ...@@ -483,8 +483,8 @@ static int __init init_hfs_fs(void)
int err; int err;
hfs_inode_cachep = kmem_cache_create("hfs_inode_cache", hfs_inode_cachep = kmem_cache_create("hfs_inode_cache",
sizeof(struct hfs_inode_info), 0, SLAB_HWCACHE_ALIGN, sizeof(struct hfs_inode_info), 0,
hfs_init_once); SLAB_HWCACHE_ALIGN|SLAB_ACCOUNT, hfs_init_once);
if (!hfs_inode_cachep) if (!hfs_inode_cachep)
return -ENOMEM; return -ENOMEM;
err = register_filesystem(&hfs_fs_type); err = register_filesystem(&hfs_fs_type);
......
...@@ -663,7 +663,7 @@ static int __init init_hfsplus_fs(void) ...@@ -663,7 +663,7 @@ static int __init init_hfsplus_fs(void)
int err; int err;
hfsplus_inode_cachep = kmem_cache_create("hfsplus_icache", hfsplus_inode_cachep = kmem_cache_create("hfsplus_icache",
HFSPLUS_INODE_SIZE, 0, SLAB_HWCACHE_ALIGN, HFSPLUS_INODE_SIZE, 0, SLAB_HWCACHE_ALIGN|SLAB_ACCOUNT,
hfsplus_init_once); hfsplus_init_once);
if (!hfsplus_inode_cachep) if (!hfsplus_inode_cachep)
return -ENOMEM; return -ENOMEM;
......
...@@ -223,7 +223,7 @@ static struct inode *hostfs_alloc_inode(struct super_block *sb) ...@@ -223,7 +223,7 @@ static struct inode *hostfs_alloc_inode(struct super_block *sb)
{ {
struct hostfs_inode_info *hi; struct hostfs_inode_info *hi;
hi = kmalloc(sizeof(*hi), GFP_KERNEL); hi = kmalloc(sizeof(*hi), GFP_KERNEL_ACCOUNT);
if (hi == NULL) if (hi == NULL)
return NULL; return NULL;
hi->fd = -1; hi->fd = -1;
......
...@@ -261,7 +261,7 @@ static int init_inodecache(void) ...@@ -261,7 +261,7 @@ static int init_inodecache(void)
hpfs_inode_cachep = kmem_cache_create("hpfs_inode_cache", hpfs_inode_cachep = kmem_cache_create("hpfs_inode_cache",
sizeof(struct hpfs_inode_info), sizeof(struct hpfs_inode_info),
0, (SLAB_RECLAIM_ACCOUNT| 0, (SLAB_RECLAIM_ACCOUNT|
SLAB_MEM_SPREAD), SLAB_MEM_SPREAD|SLAB_ACCOUNT),
init_once); init_once);
if (hpfs_inode_cachep == NULL) if (hpfs_inode_cachep == NULL)
return -ENOMEM; return -ENOMEM;
......
...@@ -1322,7 +1322,7 @@ static int __init init_hugetlbfs_fs(void) ...@@ -1322,7 +1322,7 @@ static int __init init_hugetlbfs_fs(void)
error = -ENOMEM; error = -ENOMEM;
hugetlbfs_inode_cachep = kmem_cache_create("hugetlbfs_inode_cache", hugetlbfs_inode_cachep = kmem_cache_create("hugetlbfs_inode_cache",
sizeof(struct hugetlbfs_inode_info), sizeof(struct hugetlbfs_inode_info),
0, 0, init_once); 0, SLAB_ACCOUNT, init_once);
if (hugetlbfs_inode_cachep == NULL) if (hugetlbfs_inode_cachep == NULL)
goto out2; goto out2;
......
...@@ -1883,7 +1883,7 @@ void __init inode_init(void) ...@@ -1883,7 +1883,7 @@ void __init inode_init(void)
sizeof(struct inode), sizeof(struct inode),
0, 0,
(SLAB_RECLAIM_ACCOUNT|SLAB_PANIC| (SLAB_RECLAIM_ACCOUNT|SLAB_PANIC|
SLAB_MEM_SPREAD), SLAB_MEM_SPREAD|SLAB_ACCOUNT),
init_once); init_once);
/* Hash may have been set up in inode_init_early */ /* Hash may have been set up in inode_init_early */
......
...@@ -94,7 +94,7 @@ static int __init init_inodecache(void) ...@@ -94,7 +94,7 @@ static int __init init_inodecache(void)
isofs_inode_cachep = kmem_cache_create("isofs_inode_cache", isofs_inode_cachep = kmem_cache_create("isofs_inode_cache",
sizeof(struct iso_inode_info), sizeof(struct iso_inode_info),
0, (SLAB_RECLAIM_ACCOUNT| 0, (SLAB_RECLAIM_ACCOUNT|
SLAB_MEM_SPREAD), SLAB_MEM_SPREAD|SLAB_ACCOUNT),
init_once); init_once);
if (isofs_inode_cachep == NULL) if (isofs_inode_cachep == NULL)
return -ENOMEM; return -ENOMEM;
......
...@@ -387,7 +387,7 @@ static int __init init_jffs2_fs(void) ...@@ -387,7 +387,7 @@ static int __init init_jffs2_fs(void)
jffs2_inode_cachep = kmem_cache_create("jffs2_i", jffs2_inode_cachep = kmem_cache_create("jffs2_i",
sizeof(struct jffs2_inode_info), sizeof(struct jffs2_inode_info),
0, (SLAB_RECLAIM_ACCOUNT| 0, (SLAB_RECLAIM_ACCOUNT|
SLAB_MEM_SPREAD), SLAB_MEM_SPREAD|SLAB_ACCOUNT),
jffs2_i_init_once); jffs2_i_init_once);
if (!jffs2_inode_cachep) { if (!jffs2_inode_cachep) {
pr_err("error: Failed to initialise inode cache\n"); pr_err("error: Failed to initialise inode cache\n");
......
...@@ -898,7 +898,7 @@ static int __init init_jfs_fs(void) ...@@ -898,7 +898,7 @@ static int __init init_jfs_fs(void)
jfs_inode_cachep = jfs_inode_cachep =
kmem_cache_create("jfs_ip", sizeof(struct jfs_inode_info), 0, kmem_cache_create("jfs_ip", sizeof(struct jfs_inode_info), 0,
SLAB_RECLAIM_ACCOUNT|SLAB_MEM_SPREAD, SLAB_RECLAIM_ACCOUNT|SLAB_MEM_SPREAD|SLAB_ACCOUNT,
init_once); init_once);
if (jfs_inode_cachep == NULL) if (jfs_inode_cachep == NULL)
return -ENOMEM; return -ENOMEM;
......
...@@ -409,7 +409,8 @@ const struct super_operations logfs_super_operations = { ...@@ -409,7 +409,8 @@ const struct super_operations logfs_super_operations = {
int logfs_init_inode_cache(void) int logfs_init_inode_cache(void)
{ {
logfs_inode_cache = kmem_cache_create("logfs_inode_cache", logfs_inode_cache = kmem_cache_create("logfs_inode_cache",
sizeof(struct logfs_inode), 0, SLAB_RECLAIM_ACCOUNT, sizeof(struct logfs_inode), 0,
SLAB_RECLAIM_ACCOUNT|SLAB_ACCOUNT,
logfs_init_once); logfs_init_once);
if (!logfs_inode_cache) if (!logfs_inode_cache)
return -ENOMEM; return -ENOMEM;
......
...@@ -91,7 +91,7 @@ static int __init init_inodecache(void) ...@@ -91,7 +91,7 @@ static int __init init_inodecache(void)
minix_inode_cachep = kmem_cache_create("minix_inode_cache", minix_inode_cachep = kmem_cache_create("minix_inode_cache",
sizeof(struct minix_inode_info), sizeof(struct minix_inode_info),
0, (SLAB_RECLAIM_ACCOUNT| 0, (SLAB_RECLAIM_ACCOUNT|
SLAB_MEM_SPREAD), SLAB_MEM_SPREAD|SLAB_ACCOUNT),
init_once); init_once);
if (minix_inode_cachep == NULL) if (minix_inode_cachep == NULL)
return -ENOMEM; return -ENOMEM;
......
...@@ -82,7 +82,7 @@ static int init_inodecache(void) ...@@ -82,7 +82,7 @@ static int init_inodecache(void)
ncp_inode_cachep = kmem_cache_create("ncp_inode_cache", ncp_inode_cachep = kmem_cache_create("ncp_inode_cache",
sizeof(struct ncp_inode_info), sizeof(struct ncp_inode_info),
0, (SLAB_RECLAIM_ACCOUNT| 0, (SLAB_RECLAIM_ACCOUNT|
SLAB_MEM_SPREAD), SLAB_MEM_SPREAD|SLAB_ACCOUNT),
init_once); init_once);
if (ncp_inode_cachep == NULL) if (ncp_inode_cachep == NULL)
return -ENOMEM; return -ENOMEM;
......
...@@ -1933,7 +1933,7 @@ static int __init nfs_init_inodecache(void) ...@@ -1933,7 +1933,7 @@ static int __init nfs_init_inodecache(void)
nfs_inode_cachep = kmem_cache_create("nfs_inode_cache", nfs_inode_cachep = kmem_cache_create("nfs_inode_cache",
sizeof(struct nfs_inode), sizeof(struct nfs_inode),
0, (SLAB_RECLAIM_ACCOUNT| 0, (SLAB_RECLAIM_ACCOUNT|
SLAB_MEM_SPREAD), SLAB_MEM_SPREAD|SLAB_ACCOUNT),
init_once); init_once);
if (nfs_inode_cachep == NULL) if (nfs_inode_cachep == NULL)
return -ENOMEM; return -ENOMEM;
......
...@@ -1416,7 +1416,8 @@ static int __init nilfs_init_cachep(void) ...@@ -1416,7 +1416,8 @@ static int __init nilfs_init_cachep(void)
{ {
nilfs_inode_cachep = kmem_cache_create("nilfs2_inode_cache", nilfs_inode_cachep = kmem_cache_create("nilfs2_inode_cache",
sizeof(struct nilfs_inode_info), 0, sizeof(struct nilfs_inode_info), 0,
SLAB_RECLAIM_ACCOUNT, nilfs_inode_init_once); SLAB_RECLAIM_ACCOUNT|SLAB_ACCOUNT,
nilfs_inode_init_once);
if (!nilfs_inode_cachep) if (!nilfs_inode_cachep)
goto fail; goto fail;
......
...@@ -3139,8 +3139,8 @@ static int __init init_ntfs_fs(void) ...@@ -3139,8 +3139,8 @@ static int __init init_ntfs_fs(void)
ntfs_big_inode_cache = kmem_cache_create(ntfs_big_inode_cache_name, ntfs_big_inode_cache = kmem_cache_create(ntfs_big_inode_cache_name,
sizeof(big_ntfs_inode), 0, sizeof(big_ntfs_inode), 0,
SLAB_HWCACHE_ALIGN|SLAB_RECLAIM_ACCOUNT|SLAB_MEM_SPREAD, SLAB_HWCACHE_ALIGN|SLAB_RECLAIM_ACCOUNT|SLAB_MEM_SPREAD|
ntfs_big_inode_init_once); SLAB_ACCOUNT, ntfs_big_inode_init_once);
if (!ntfs_big_inode_cache) { if (!ntfs_big_inode_cache) {
pr_crit("Failed to create %s!\n", ntfs_big_inode_cache_name); pr_crit("Failed to create %s!\n", ntfs_big_inode_cache_name);
goto big_inode_err_out; goto big_inode_err_out;
......
...@@ -638,7 +638,7 @@ static int __init init_dlmfs_fs(void) ...@@ -638,7 +638,7 @@ static int __init init_dlmfs_fs(void)
dlmfs_inode_cache = kmem_cache_create("dlmfs_inode_cache", dlmfs_inode_cache = kmem_cache_create("dlmfs_inode_cache",
sizeof(struct dlmfs_inode_private), sizeof(struct dlmfs_inode_private),
0, (SLAB_HWCACHE_ALIGN|SLAB_RECLAIM_ACCOUNT| 0, (SLAB_HWCACHE_ALIGN|SLAB_RECLAIM_ACCOUNT|
SLAB_MEM_SPREAD), SLAB_MEM_SPREAD|SLAB_ACCOUNT),
dlmfs_init_once); dlmfs_init_once);
if (!dlmfs_inode_cache) { if (!dlmfs_inode_cache) {
status = -ENOMEM; status = -ENOMEM;
......
...@@ -1766,7 +1766,7 @@ static int ocfs2_initialize_mem_caches(void) ...@@ -1766,7 +1766,7 @@ static int ocfs2_initialize_mem_caches(void)
sizeof(struct ocfs2_inode_info), sizeof(struct ocfs2_inode_info),
0, 0,
(SLAB_HWCACHE_ALIGN|SLAB_RECLAIM_ACCOUNT| (SLAB_HWCACHE_ALIGN|SLAB_RECLAIM_ACCOUNT|
SLAB_MEM_SPREAD), SLAB_MEM_SPREAD|SLAB_ACCOUNT),
ocfs2_inode_init_once); ocfs2_inode_init_once);
ocfs2_dquot_cachep = kmem_cache_create("ocfs2_dquot_cache", ocfs2_dquot_cachep = kmem_cache_create("ocfs2_dquot_cache",
sizeof(struct ocfs2_dquot), sizeof(struct ocfs2_dquot),
......
...@@ -443,7 +443,7 @@ static int __init init_openprom_fs(void) ...@@ -443,7 +443,7 @@ static int __init init_openprom_fs(void)
sizeof(struct op_inode_info), sizeof(struct op_inode_info),
0, 0,
(SLAB_RECLAIM_ACCOUNT | (SLAB_RECLAIM_ACCOUNT |
SLAB_MEM_SPREAD), SLAB_MEM_SPREAD | SLAB_ACCOUNT),
op_inode_init_once); op_inode_init_once);
if (!op_inode_cachep) if (!op_inode_cachep)
return -ENOMEM; return -ENOMEM;
......
...@@ -95,7 +95,8 @@ void __init proc_init_inodecache(void) ...@@ -95,7 +95,8 @@ void __init proc_init_inodecache(void)
proc_inode_cachep = kmem_cache_create("proc_inode_cache"