This is a note to let you know that I've just added the patch titled ipc,shm: shorten critical region in shmctl_down to the 3.10-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: ipc-shm-shorten-critical-region-in-shmctl_down.patch and it can be found in the queue-3.10 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From 79ccf0f8c8e04e8b9eda6645ba0f63b0915a3075 Mon Sep 17 00:00:00 2001 From: Davidlohr Bueso <davidlohr.bueso@xxxxxx> Date: Wed, 11 Sep 2013 14:26:16 -0700 Subject: ipc,shm: shorten critical region in shmctl_down From: Davidlohr Bueso <davidlohr.bueso@xxxxxx> commit 79ccf0f8c8e04e8b9eda6645ba0f63b0915a3075 upstream. Instead of holding the ipc lock for the entire function, use the ipcctl_pre_down_nolock and only acquire the lock for specific commands: RMID and SET. Signed-off-by: Davidlohr Bueso <davidlohr.bueso@xxxxxx> Tested-by: Sedat Dilek <sedat.dilek@xxxxxxxxx> Cc: Rik van Riel <riel@xxxxxxxxxx> Cc: Manfred Spraul <manfred@xxxxxxxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> Signed-off-by: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx> Cc: Mike Galbraith <efault@xxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- ipc/shm.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) --- a/ipc/shm.c +++ b/ipc/shm.c @@ -780,11 +780,10 @@ static int shmctl_down(struct ipc_namesp down_write(&shm_ids(ns).rw_mutex); rcu_read_lock(); - ipcp = ipcctl_pre_down(ns, &shm_ids(ns), shmid, cmd, - &shmid64.shm_perm, 0); + ipcp = ipcctl_pre_down_nolock(ns, &shm_ids(ns), shmid, cmd, + &shmid64.shm_perm, 0); if (IS_ERR(ipcp)) { err = PTR_ERR(ipcp); - /* the ipc lock is not held upon failure */ goto out_unlock1; } @@ -792,14 +791,16 @@ static int shmctl_down(struct ipc_namesp err = security_shm_shmctl(shp, cmd); if (err) - goto out_unlock0; + goto out_unlock1; switch (cmd) { case IPC_RMID: + ipc_lock_object(&shp->shm_perm); /* do_shm_rmid unlocks the ipc object and rcu */ do_shm_rmid(ns, ipcp); goto out_up; case IPC_SET: + ipc_lock_object(&shp->shm_perm); err = ipc_update_perm(&shmid64.shm_perm, ipcp); if (err) goto out_unlock0; @@ -807,6 +808,7 @@ static int shmctl_down(struct ipc_namesp break; default: err = -EINVAL; + goto out_unlock1; } out_unlock0: Patches currently in stable-queue which might be from davidlohr.bueso@xxxxxx are queue-3.10/ipc-shm-shorten-critical-region-in-shmctl_down.patch queue-3.10/ipc-msg-introduce-lockless-functions-to-obtain-the-ipc-object.patch queue-3.10/ipc-msg-shorten-critical-region-in-msgctl_down.patch queue-3.10/ipc-shm-introduce-lockless-functions-to-obtain-the-ipc-object.patch queue-3.10/ipc-remove-unused-functions.patch queue-3.10/ipc-shm-shorten-critical-region-for-shmat.patch queue-3.10/ipc-msg-introduce-msgctl_nolock.patch queue-3.10/ipc-move-rcu-lock-out-of-ipc_addid.patch queue-3.10/ipc-sem-separate-wait-for-zero-and-alter-tasks-into-seperate-queues.patch queue-3.10/ipc-shm-shorten-critical-region-for-shmctl.patch queue-3.10/ipc-msg-shorten-critical-region-in-msgsnd.patch queue-3.10/ipc-shm-introduce-shmctl_nolock.patch queue-3.10/ipc-drop-ipcctl_pre_down.patch queue-3.10/ipc-util.c-ipc_rcu_alloc-cacheline-align-allocation.patch queue-3.10/ipc-introduce-ipc-object-locking-helpers.patch queue-3.10/ipc-sem.c-cacheline-align-the-semaphore-structures.patch queue-3.10/ipc-msg-shorten-critical-region-in-msgrcv.patch queue-3.10/ipc-msg-make-msgctl_nolock-lockless.patch queue-3.10/ipc-sem.c-always-use-only-one-queue-for-alter-operations.patch queue-3.10/ipc-shm-cleanup-do_shmat-pasta.patch queue-3.10/ipc-move-locking-out-of-ipcctl_pre_down_nolock.patch queue-3.10/ipc-close-open-coded-spin-lock-calls.patch queue-3.10/ipc-sem.c-rename-try_atomic_semop-to-perform_atomic_semop-docu-update.patch queue-3.10/ipc-shm-make-shmctl_nolock-lockless.patch queue-3.10/ipc-sem.c-replace-shared-sem_otime-with-per-semaphore-value.patch -- To unsubscribe from this list: send the line "unsubscribe stable" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html