[<prev] [next>] [day] [month] [year] [list]
Message-ID: <3315ab04-eb3d-6453-a897-7ed5886454e4@virtuozzo.com>
Date: Mon, 19 Jul 2021 13:45:22 +0300
From: Vasily Averin <vvs@...tuozzo.com>
To: Andrew Morton <akpm@...ux-foundation.org>
Cc: cgroups@...r.kernel.org, Michal Hocko <mhocko@...nel.org>,
Shakeel Butt <shakeelb@...gle.com>,
Johannes Weiner <hannes@...xchg.org>,
Vladimir Davydov <vdavydov.dev@...il.com>,
Roman Gushchin <guro@...com>,
Alexander Viro <viro@...iv.linux.org.uk>,
Jeff Layton <jlayton@...nel.org>,
"J. Bruce Fields" <bfields@...ldses.org>,
linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH v5 10/16] memcg: enable accounting for fasync_cache
fasync_struct is used by almost all character device drivers to set up
the fasync queue, and for regular files by the file lease code.
This structure is quite small but long-living and it can be assigned
for any open file.
It makes sense to account for its allocations to restrict the host's
memory consumption from inside the memcg-limited container.
Signed-off-by: Vasily Averin <vvs@...tuozzo.com>
---
fs/fcntl.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/fs/fcntl.c b/fs/fcntl.c
index dfc72f1..7941559 100644
--- a/fs/fcntl.c
+++ b/fs/fcntl.c
@@ -1049,7 +1049,8 @@ static int __init fcntl_init(void)
__FMODE_EXEC | __FMODE_NONOTIFY));
fasync_cache = kmem_cache_create("fasync_cache",
- sizeof(struct fasync_struct), 0, SLAB_PANIC, NULL);
+ sizeof(struct fasync_struct), 0,
+ SLAB_PANIC | SLAB_ACCOUNT, NULL);
return 0;
}
--
1.8.3.1
Powered by blists - more mailing lists