lkml.org 
[lkml]   [2013]   [May]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
Subjectipc/sem.c: Lockup with complex ops, comments not updated
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


\
 
 \ /
  Last update: 2013-05-18 16:21    [W:0.086 / U:0.052 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site