path: root/ipc/msgutil.c
diff options
authorAristeu Rozanski <>2016-10-27 17:46:35 -0700
committerLinus Torvalds <>2016-10-27 18:43:43 -0700
commit8c8d4d45204902e144abc0f15b7c658828028fa1 (patch)
treeeda6025c8e81a1a5f2a7ebe8e737fd8004a3a435 /ipc/msgutil.c
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: Signed-off-by: Aristeu Rozanski <> Reported-by: Stefan Schimanski <> Acked-by: Davidlohr Bueso <> Cc: Alexey Dobriyan <> Cc: Johannes Weiner <> Cc: Michal Hocko <> Cc: Vladimir Davydov <> Cc: Stefan Schimanski <> Cc: Michal Hocko <> Signed-off-by: Andrew Morton <> Signed-off-by: Linus Torvalds <>
Diffstat (limited to 'ipc/msgutil.c')
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)
size_t alen;
alen = min(len, DATALEN_MSG);
- msg = kmalloc(sizeof(*msg) + alen, GFP_KERNEL);
+ msg = kmalloc(sizeof(*msg) + alen, GFP_KERNEL_ACCOUNT);
if (msg == NULL)
return NULL;
@@ -65,7 +65,7 @@ static struct msg_msg *alloc_msg(size_t len)
while (len > 0) {
struct msg_msgseg *seg;
alen = min(len, DATALEN_SEG);
- seg = kmalloc(sizeof(*seg) + alen, GFP_KERNEL);
+ seg = kmalloc(sizeof(*seg) + alen, GFP_KERNEL_ACCOUNT);
if (seg == NULL)
goto out_err;
*pseg = seg;