[Devel] [PATCH RHEL COMMIT] ms/memcg: enable accounting for file lock caches

Konstantin Khorenko khorenko at virtuozzo.com
Tue Sep 28 14:16:21 MSK 2021


The commit is pushed to "branch-rh9-5.14.vz9.1.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after ark-5.14
------>
commit 6433903745bda56a15fc711dc0d8961122467f3d
Author: Vasily Averin <vvs at virtuozzo.com>
Date:   Tue Sep 28 14:16:21 2021 +0300

    ms/memcg: enable accounting for file lock caches
    
    User can create file locks for each open file and force kernel to allocate
    small but long-living objects per each open file.
    
    It makes sense to account for these objects to limit the host's memory
    consumption from inside the memcg-limited container.
    
    Link: https://lkml.kernel.org/r/b009f4c7-f0ab-c0ec-8e83-918f47d677da@virtuozzo.com
    Signed-off-by: Vasily Averin <vvs at virtuozzo.com>
    
    Reviewed-by: Shakeel Butt <shakeelb at google.com>
    Cc: Alexander Viro <viro at zeniv.linux.org.uk>
    Cc: Alexey Dobriyan <adobriyan at gmail.com>
    Cc: Andrei Vagin <avagin at gmail.com>
    Cc: Borislav Petkov <bp at alien8.de>
    Cc: Borislav Petkov <bp at suse.de>
    Cc: Christian Brauner <christian.brauner at ubuntu.com>
    Cc: Dmitry Safonov <0x7f454c46 at gmail.com>
    Cc: "Eric W. Biederman" <ebiederm at xmission.com>
    Cc: Greg Kroah-Hartman <gregkh at linuxfoundation.org>
    Cc: "H. Peter Anvin" <hpa at zytor.com>
    Cc: Ingo Molnar <mingo at redhat.com>
    Cc: "J. Bruce Fields" <bfields at fieldses.org>
    Cc: Jeff Layton <jlayton at kernel.org>
    Cc: Jens Axboe <axboe at kernel.dk>
    Cc: Jiri Slaby <jirislaby at kernel.org>
    Cc: Johannes Weiner <hannes at cmpxchg.org>
    Cc: Kirill Tkhai <ktkhai at virtuozzo.com>
    Cc: Michal Hocko <mhocko at kernel.org>
    Cc: Oleg Nesterov <oleg at redhat.com>
    Cc: Roman Gushchin <guro at fb.com>
    Cc: Serge Hallyn <serge at hallyn.com>
    Cc: Tejun Heo <tj at kernel.org>
    Cc: Thomas Gleixner <tglx at linutronix.de>
    Cc: Vladimir Davydov <vdavydov.dev at gmail.com>
    Cc: Yutian Yang <nglaive at gmail.com>
    Cc: Zefan Li <lizefan.x at bytedance.com>
    Signed-off-by: Andrew Morton <akpm at linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds at linux-foundation.org>
    (cherry picked from commit 0f12156dff2862ac54235fc72703f18770769042)
    https://jira.sw.ru/browse/PSBM-133990
    Signed-off-by: Vasily Averin <vvs at virtuozzo.com>
---
 fs/locks.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/fs/locks.c b/fs/locks.c
index 3edcf30793d5..b091aed32437 100644
--- a/fs/locks.c
+++ b/fs/locks.c
@@ -3056,10 +3056,12 @@ static int __init filelock_init(void)
 	int i;
 
 	flctx_cache = kmem_cache_create("file_lock_ctx",
-			sizeof(struct file_lock_context), 0, SLAB_PANIC, NULL);
+			sizeof(struct file_lock_context), 0,
+			SLAB_PANIC | SLAB_ACCOUNT, NULL);
 
 	filelock_cache = kmem_cache_create("file_lock_cache",
-			sizeof(struct file_lock), 0, SLAB_PANIC, NULL);
+			sizeof(struct file_lock), 0,
+			SLAB_PANIC | SLAB_ACCOUNT, NULL);
 
 	for_each_possible_cpu(i) {
 		struct file_lock_list_struct *fll = per_cpu_ptr(&file_lock_list, i);


More information about the Devel mailing list