public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* ipc/sem.c: Lockup with complex ops, comments not updated
@ 2013-05-18 13:48 Manfred Spraul
  2013-05-19 22:32 ` [PATCH] ipc,sem: move restart loop to do_smart_update Rik van Riel
  0 siblings, 1 reply; 4+ messages in thread
From: Manfred Spraul @ 2013-05-18 13:48 UTC (permalink / raw)
  To: riel; +Cc: Linux Kernel Mailing List

Hi Rik,

I like your change to the ipc/sem locking:
A scheme with a per-semaphore lock and without the overhead of always 
acquiring both the global and the per-semaphore lock.

But:
1) I found one bug with your sem locking changes:
If
- a complex operation is sleeping [would be woken up by update_queue(,-1)]
- a simple op is sleeping
- the success of the simple op would allow the complex op to complete
     [i.e.: update_queue(,sem_num) changes the semaphore value to the 
value that the complex op waits on]
- an operation wakes up the simple op.

then the complex op is not woken up.

One fix would be a loop in do_smart_update():
- first check the global queue
- then the per-semaphore queues
- if one of the per-semaphore queues made progress: check the global 
queue again
- if the global queue made progress: check the per semaphore queues again
...

2) Your patches remove FIFO ordering of the wakeups:
As far as I can see complex ops are now preferred over simple ops.
It's not a bug, noone exept linux implements FIFO.
But the comment it line 28 should be updated

Should I write a patch, do you want to fix it yourself?

--
     Manfred

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-05-26  6:09 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-18 13:48 ipc/sem.c: Lockup with complex ops, comments not updated Manfred Spraul
2013-05-19 22:32 ` [PATCH] ipc,sem: move restart loop to do_smart_update Rik van Riel
2013-05-22 22:20   ` Davidlohr Bueso
2013-05-26  6:09   ` Manfred Spraul

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox