memcg: enable accounting of ipc resources
[sfrench/cifs-2.6.git] / ipc / sem.c
index 971e75d28364e5a3c2a64f9bfc9bbf5bcaef91c9..1a8b9f0ac047be005635d0edefb24697d18d0ff6 100644 (file)
--- a/ipc/sem.c
+++ b/ipc/sem.c
@@ -514,7 +514,7 @@ static struct sem_array *sem_alloc(size_t nsems)
        if (nsems > (INT_MAX - sizeof(*sma)) / sizeof(sma->sems[0]))
                return NULL;
 
-       sma = kvzalloc(struct_size(sma, sems, nsems), GFP_KERNEL);
+       sma = kvzalloc(struct_size(sma, sems, nsems), GFP_KERNEL_ACCOUNT);
        if (unlikely(!sma))
                return NULL;
 
@@ -1855,7 +1855,7 @@ static inline int get_undo_list(struct sem_undo_list **undo_listp)
 
        undo_list = current->sysvsem.undo_list;
        if (!undo_list) {
-               undo_list = kzalloc(sizeof(*undo_list), GFP_KERNEL);
+               undo_list = kzalloc(sizeof(*undo_list), GFP_KERNEL_ACCOUNT);
                if (undo_list == NULL)
                        return -ENOMEM;
                spin_lock_init(&undo_list->lock);
@@ -1941,7 +1941,7 @@ static struct sem_undo *find_alloc_undo(struct ipc_namespace *ns, int semid)
 
        /* step 2: allocate new undo structure */
        new = kvzalloc(sizeof(struct sem_undo) + sizeof(short)*nsems,
-                      GFP_KERNEL);
+                      GFP_KERNEL_ACCOUNT);
        if (!new) {
                ipc_rcu_putref(&sma->sem_perm, sem_rcu_free);
                return ERR_PTR(-ENOMEM);
@@ -2005,7 +2005,8 @@ static long do_semtimedop(int semid, struct sembuf __user *tsops,
        if (nsops > ns->sc_semopm)
                return -E2BIG;
        if (nsops > SEMOPM_FAST) {
-               sops = kvmalloc_array(nsops, sizeof(*sops), GFP_KERNEL);
+               sops = kvmalloc_array(nsops, sizeof(*sops),
+                                     GFP_KERNEL_ACCOUNT);
                if (sops == NULL)
                        return -ENOMEM;
        }