Gitweb: http://git.kernel.org/linus/0a2b9d4c79671b05956806ede5d054e03ae56280
Commit: 0a2b9d4c79671b05956806ede5d054e03ae56280
Parent: fd5db42254518fbf241dc454e918598fbe494fa2
Author: Manfred Spraul <manfred@colorfullife.com>
AuthorDate: Wed May 26 14:43:41 2010 -0700
Committer: Linus Torvalds <torvalds@linux-foundation.org>
CommitDate: Thu May 27 09:12:49 2010 -0700
ipc/sem.c: move wake_up_process out of the spinlock section
The wake-up part of semtimedop() consists out of two steps:
- the right tasks must be identified.
- they must be woken up.
Right now, both steps run while the array spinlock is held. This patch
reorders the code and moves the actual wake_up_process() behind the point
where the spinlock is dropped.
The code also moves setting sem->sem_otime to one place: It does not make
sense to set the last modify time multiple times.
[akpm@linux-foundation.org: repair kerneldoc]
[akpm@linux-foundation.org: fix uninitialised retval]
Signed-off-by: Manfred Spraul <manfred@colorfullife.com>
Cc: Chris Mason <chris.mason@oracle.com>
Cc: Zach Brown <zach.brown@oracle.com>
Cc: Jens Axboe <jens.axboe@oracle.com>
Cc: Nick Piggin <npiggin@suse.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
---
ipc/sem.c | 123 +++++++++++++++++++++++++++++++++++++++++++++----------------
1 files changed, 91 insertions(+), 32 deletions(-)
diff --git a/ipc/sem.c b/ipc/sem.c
index 81a9c74..a744eb5 100644
--- a/ipc/sem.c
+++ b/ipc/sem.c
@@ -381,7 +381,6 @@ static int try_atomic_semop (struct sem_array * sma, struct sembuf * sops,
sop--;
}
- sma->sem_otime = get_seconds();
return 0;
out_of_range:
@@ -404,25 +403,51 @@ undo:
return result;
}
-/*
- * Wake up a process waiting on the sem queue with a given error.
- * The queue is invalid (may not be accessed) after the ...