* Matthew Wilcox <matthew@wil.cx> wrote:the gain is rather obvious: two parallel up()s (or just up()s which come close enough after each other) will wake up two tasks in parallel. With your patch, the first guy wakes up and then it wakes up the second guy. I.e. your patch serializes the wakeup chain, mine keeps it parallel. the cache line dirtying is rather secondary to any solution - the first goal for any locking primitive is to get scheduling precise: to not wake up more tasks than optimal and to not wake up less tasks than optimal. i.e. can you see any conceptual hole in the patch below? Ingo --- kernel/semaphore.c | 6 ++++++ 1 file changed, 6 insertions(+) Index: linux/kernel/semaphore.c =================================================================== --- linux.orig/kernel/semaphore.c +++ linux/kernel/semaphore.c @@ -258,5 +258,11 @@ static noinline void __sched __up(struct { struct semaphore_waiter *waiter = list_first_entry(&sem->wait_list, struct semaphore_waiter, list); + /* + * Rotate sleepers - to make sure all of them get woken in case + * of parallel up()s: + */ + list_move_tail(&waiter->list, &sem->wait_list); + wake_up_process(waiter->task); } --
| Amit K. Arora | [RFC] Heads up on sys_fallocate() |
| H. Peter Anvin | Re: [RFC 00/15] x86_64: Optimize percpu accesses |
| Nicolas Pitre | Re: [RFC patch 08/18] cnt32_to_63 should use smp_rmb() |
| Bart Van Assche | Integration of SCST in the mainstream Linux kernel |
git: | |
| Jarek Poplawski | [PATCH] pkt_sched: Destroy gen estimators under rtnl_lock(). |
| David Miller | [GIT]: Networking |
| Gerrit Renker | [PATCH 27/37] dccp: Integration of dynamic feature activation - part 2 (server side) |
| Natalie Protasevich | [BUG] New Kernel Bugs |
