aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAristeu Rozanski <arozansk@redhat.com>2016-10-27 20:46:35 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2016-10-27 21:43:43 -0400
commit8c8d4d45204902e144abc0f15b7c658828028fa1 (patch)
treeeda6025c8e81a1a5f2a7ebe8e737fd8004a3a435
parent07a63c41fa1f6533f5668e5b33a295bfd63aa534 (diff)
ipc: account for kmem usage on mqueue and msg
When kmem accounting switched from account by default to only account if flagged by __GFP_ACCOUNT, IPC mqueue and messages was left out. The production use case at hand is that mqueues should be customizable via sysctls in Docker containers in a Kubernetes cluster. This can only be safely allowed to the users of the cluster (without the risk that they can cause resource shortage on a node, influencing other users' containers) if all resources they control are bounded, i.e. accounted for. Link: http://lkml.kernel.org/r/1476806075-1210-1-git-send-email-arozansk@redhat.com Signed-off-by: Aristeu Rozanski <arozansk@redhat.com> Reported-by: Stefan Schimanski <sttts@redhat.com> Acked-by: Davidlohr Bueso <dave@stgolabs.net> Cc: Alexey Dobriyan <adobriyan@gmail.com> Cc: Johannes Weiner <hannes@cmpxchg.org> Cc: Michal Hocko <mhocko@kernel.org> Cc: Vladimir Davydov <vdavydov.dev@gmail.com> Cc: Stefan Schimanski <sttts@redhat.com> Cc: Michal Hocko <mhocko@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--ipc/msgutil.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/ipc/msgutil.c b/ipc/msgutil.c
index a521999de4f1..bf74eaa5c39f 100644
--- a/ipc/msgutil.c
+++ b/ipc/msgutil.c
@@ -53,7 +53,7 @@ static struct msg_msg *alloc_msg(size_t len)
53 size_t alen; 53 size_t alen;
54 54
55 alen = min(len, DATALEN_MSG); 55 alen = min(len, DATALEN_MSG);
56 msg = kmalloc(sizeof(*msg) + alen, GFP_KERNEL); 56 msg = kmalloc(sizeof(*msg) + alen, GFP_KERNEL_ACCOUNT);
57 if (msg == NULL) 57 if (msg == NULL)
58 return NULL; 58 return NULL;
59 59
@@ -65,7 +65,7 @@ static struct msg_msg *alloc_msg(size_t len)
65 while (len > 0) { 65 while (len > 0) {
66 struct msg_msgseg *seg; 66 struct msg_msgseg *seg;
67 alen = min(len, DATALEN_SEG); 67 alen = min(len, DATALEN_SEG);
68 seg = kmalloc(sizeof(*seg) + alen, GFP_KERNEL); 68 seg = kmalloc(sizeof(*seg) + alen, GFP_KERNEL_ACCOUNT);
69 if (seg == NULL) 69 if (seg == NULL)
70 goto out_err; 70 goto out_err;
71 *pseg = seg; 71 *pseg = seg;