[Devel] [PATCH RHEL8 COMMIT] memcg: enable accounting of ipc resources

Konstantin Khorenko khorenko at virtuozzo.com
Tue Apr 13 13:20:34 MSK 2021


The commit is pushed to "branch-rh8-4.18.0-240.1.1.vz8.5.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh8-4.18.0-240.1.1.vz8.5.12
------>
commit 27ded351bee78555a9ae019ffb92c5f3f4e509af
Author: Vasily Averin <vvs at virtuozzo.com>
Date:   Tue Apr 13 13:20:34 2021 +0300

    memcg: enable accounting of ipc resources
    
    This patch enables memcg accounting for IPC messages, semaphores
    and shared memory objects.
    
    In vz7 it was accounted by using ipc_rcu_alloc().
    
    https://jira.sw.ru/browse/PSBM-120694
    Signed-off-by: Vasily Averin <vvs at virtuozzo.com>
---
 ipc/msg.c | 2 +-
 ipc/sem.c | 2 +-
 ipc/shm.c | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/ipc/msg.c b/ipc/msg.c
index 883642cf2b27..488cc9e4d7af 100644
--- a/ipc/msg.c
+++ b/ipc/msg.c
@@ -137,7 +137,7 @@ static int newque(struct ipc_namespace *ns, struct ipc_params *params)
 	key_t key = params->key;
 	int msgflg = params->flg;
 
-	msq = kvmalloc(sizeof(*msq), GFP_KERNEL);
+	msq = kvmalloc(sizeof(*msq), GFP_KERNEL_ACCOUNT);
 	if (unlikely(!msq))
 		return -ENOMEM;
 
diff --git a/ipc/sem.c b/ipc/sem.c
index 476ea3a22de4..86f522d7bceb 100644
--- a/ipc/sem.c
+++ b/ipc/sem.c
@@ -494,7 +494,7 @@ static struct sem_array *sem_alloc(size_t nsems)
 		return NULL;
 
 	size = sizeof(*sma) + nsems * sizeof(sma->sems[0]);
-	sma = kvmalloc(size, GFP_KERNEL);
+	sma = kvmalloc(size, GFP_KERNEL_ACCOUNT);
 	if (unlikely(!sma))
 		return NULL;
 
diff --git a/ipc/shm.c b/ipc/shm.c
index 7394d05f8c0b..485328778bef 100644
--- a/ipc/shm.c
+++ b/ipc/shm.c
@@ -619,7 +619,7 @@ static int newseg(struct ipc_namespace *ns, struct ipc_params *params)
 			ns->shm_tot + numpages > ns->shm_ctlall)
 		return -ENOSPC;
 
-	shp = kvmalloc(sizeof(*shp), GFP_KERNEL);
+	shp = kvmalloc(sizeof(*shp), GFP_KERNEL_ACCOUNT);
 	if (unlikely(!shp))
 		return -ENOMEM;
 


More information about the Devel mailing list