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 68412bedf57ec356f8939728a7b9d3eab1528fa0
Author: Vasily Averin <v...@virtuozzo.com>
Date:   Tue Sep 28 14:16:20 2021 +0300

    ms/memcg: enable accounting for pollfd and select bits arrays
    
    User can call select/poll system calls with a large number of assigned
    file descriptors and force kernel to allocate up to several pages of
    memory till end of these sleeping system calls.  We have here long-living
    unaccounted per-task allocations.
    
    It makes sense to account for these allocations to restrict the host's
    memory consumption from inside the memcg-limited container.
    
    Link: 
https://lkml.kernel.org/r/56e31cb5-6e1e-bdba-d7ca-be64b9842...@virtuozzo.com
    Signed-off-by: Vasily Averin <v...@virtuozzo.com>
    
    Reviewed-by: Shakeel Butt <shake...@google.com>
    Cc: Alexander Viro <v...@zeniv.linux.org.uk>
    Cc: Alexey Dobriyan <adobri...@gmail.com>
    Cc: Andrei Vagin <ava...@gmail.com>
    Cc: Borislav Petkov <b...@alien8.de>
    Cc: Borislav Petkov <b...@suse.de>
    Cc: Christian Brauner <christian.brau...@ubuntu.com>
    Cc: Dmitry Safonov <0x7f454...@gmail.com>
    Cc: "Eric W. Biederman" <ebied...@xmission.com>
    Cc: Greg Kroah-Hartman <gre...@linuxfoundation.org>
    Cc: "H. Peter Anvin" <h...@zytor.com>
    Cc: Ingo Molnar <mi...@redhat.com>
    Cc: "J. Bruce Fields" <bfie...@fieldses.org>
    Cc: Jeff Layton <jlay...@kernel.org>
    Cc: Jens Axboe <ax...@kernel.dk>
    Cc: Jiri Slaby <jirisl...@kernel.org>
    Cc: Johannes Weiner <han...@cmpxchg.org>
    Cc: Kirill Tkhai <ktk...@virtuozzo.com>
    Cc: Michal Hocko <mho...@kernel.org>
    Cc: Oleg Nesterov <o...@redhat.com>
    Cc: Roman Gushchin <g...@fb.com>
    Cc: Serge Hallyn <se...@hallyn.com>
    Cc: Tejun Heo <t...@kernel.org>
    Cc: Thomas Gleixner <t...@linutronix.de>
    Cc: Vladimir Davydov <vdavydov....@gmail.com>
    Cc: Yutian Yang <ngla...@gmail.com>
    Cc: Zefan Li <lizefa...@bytedance.com>
    Signed-off-by: Andrew Morton <a...@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torva...@linux-foundation.org>
    (cherry picked from commit b655843444152c0a14b749308e4cb35d91cbcf0b)
    https://jira.sw.ru/browse/PSBM-133990
    Signed-off-by: Vasily Averin <v...@virtuozzo.com>
---
 fs/select.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/select.c b/fs/select.c
index 945896d0ac9e..e83e563a351d 100644
--- a/fs/select.c
+++ b/fs/select.c
@@ -655,7 +655,7 @@ int core_sys_select(int n, fd_set __user *inp, fd_set 
__user *outp,
                        goto out_nofds;
 
                alloc_size = 6 * size;
-               bits = kvmalloc(alloc_size, GFP_KERNEL);
+               bits = kvmalloc(alloc_size, GFP_KERNEL_ACCOUNT);
                if (!bits)
                        goto out_nofds;
        }
@@ -1000,7 +1000,7 @@ static int do_sys_poll(struct pollfd __user *ufds, 
unsigned int nfds,
 
                len = min(todo, POLLFD_PER_PAGE);
                walk = walk->next = kmalloc(struct_size(walk, entries, len),
-                                           GFP_KERNEL);
+                                           GFP_KERNEL_ACCOUNT);
                if (!walk) {
                        err = -ENOMEM;
                        goto out_fds;
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel

Reply via email to