[Devel] [PATCH RHEL7 COMMIT] ub: properly charge and uncharge shmem
Konstantin Khorenko
khorenko at odin.com
Tue May 19 07:05:29 PDT 2015
The commit is pushed to "branch-rh7-3.10.0-123.1.2-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-123.1.2.vz7.5.3
------>
commit 79d706d7d11a0d465930314657a8658ec20c4683
Author: Andrew Perepechko <panda at cloudlinux.com>
Date: Tue May 19 18:05:29 2015 +0400
ub: properly charge and uncharge shmem
Currently, shmem_lock immediately and
unconditionally uncharges what it has
just charged for a lock request.
This, indeed, causes a double uncharge
with something like the following:
shmid = shmget(12345, 8192, IPC_CREAT | 0666);
rc = shmctl(shmid, SHM_LOCK, NULL);
shmctl(shmid, IPC_RMID, 0);
with the following in the kernel log:
[ 455.815025] Uncharging too much 2 h 0, res lockedpages ub 0
Signed-off-by: Andrew Perepechko <panda at cloudlinux.com>
Acked-by: Vladimir Davydov <vdavydov at parallels.com>
---
mm/shmem.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/mm/shmem.c b/mm/shmem.c
index a6b3e30..d09a230 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -1359,11 +1359,13 @@ int shmem_lock(struct file *file, int lock, struct user_struct *user)
mapping_set_unevictable(file->f_mapping);
}
if (!lock && (info->flags & VM_LOCKED) && user) {
+ ub_lockedshm_uncharge(info, inode->i_size);
user_shm_unlock(inode->i_size, user);
info->flags &= ~VM_LOCKED;
mapping_clear_unevictable(file->f_mapping);
}
- retval = 0;
+ spin_unlock(&info->lock);
+ return 0;
out_nomem:
ub_lockedshm_uncharge(info, inode->i_size);
More information about the Devel
mailing list