linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 7/9] memcg: accounting for mnt_cache entries
@ 2021-03-09  8:04 Vasily Averin
  0 siblings, 0 replies; only message in thread
From: Vasily Averin @ 2021-03-09  8:04 UTC (permalink / raw)
  To: cgroups, linux-mm; +Cc: Johannes Weiner, Michal Hocko, Vladimir Davydov

Objects can be created from memcg-limited tasks
but its misuse may lead to host OOM.

Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
---
 fs/namespace.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/fs/namespace.c b/fs/namespace.c
index 56bb5a5..d550c2a 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -203,7 +203,8 @@ static struct mount *alloc_vfsmnt(const char *name)
 			goto out_free_cache;
 
 		if (name) {
-			mnt->mnt_devname = kstrdup_const(name, GFP_KERNEL);
+			mnt->mnt_devname = kstrdup_const(name,
+							 GFP_KERNEL_ACCOUNT);
 			if (!mnt->mnt_devname)
 				goto out_free_id;
 		}
@@ -4213,7 +4214,7 @@ void __init mnt_init(void)
 	int err;
 
 	mnt_cache = kmem_cache_create("mnt_cache", sizeof(struct mount),
-			0, SLAB_HWCACHE_ALIGN | SLAB_PANIC, NULL);
+			0, SLAB_HWCACHE_ALIGN|SLAB_PANIC|SLAB_ACCOUNT, NULL);
 
 	mount_hashtable = alloc_large_system_hash("Mount-cache",
 				sizeof(struct hlist_head),
-- 
1.8.3.1



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-03-09  8:04 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-09  8:04 [PATCH 7/9] memcg: accounting for mnt_cache entries Vasily Averin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox