History

memcg: enable accounting for signals

When a user send a signal to any another processes it forces the kernel to allocate memory for 'struct sigqueue' objects. The number of signals is limited by RLIMIT_SIGPENDING resource limit, but even the default settings allow each user to consume up to several megabytes of memory. It makes sense to account for these allocations to restrict the host's memory consumption from inside the memcg-limited container.

Vasily Averin committed 5 years ago

Commit 5f58c391 parent 18319491 file · +1 −1Browse files

Unified · Split

kernel/signal.c+1−1
@@ -4663,7 +4663,7 @@ void __init signals_init(void) · 4662 unmodified lines
46634663 {
46644664 siginfo_buildtime_checks();
46654665
4666− sigqueue_cachep = KMEM_CACHE(sigqueue, SLAB_PANIC);
4666+ sigqueue_cachep = KMEM_CACHE(sigqueue, SLAB_PANIC | SLAB_ACCOUNT);
46674667 }
46684668
46694669 #ifdef CONFIG_KGDB_KDB