diff options
author | Manfred Spraul <manfred@colorfullife.com> | 2009-12-15 16:47:34 -0800 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-12-16 07:20:10 -0800 |
commit | d987f8b213f2cdcc52b2ca9ee67161516e4d256a (patch) | |
tree | 12ed1a267c8fd3ea0343d6a77f1c332b775d4dfe /block | |
parent | 636c6be823870d829b37fc96655bb8820a6a9be9 (diff) | |
download | lwn-d987f8b213f2cdcc52b2ca9ee67161516e4d256a.tar.gz lwn-d987f8b213f2cdcc52b2ca9ee67161516e4d256a.zip |
ipc/sem.c: optimize single sops when semval is zero
If multiple simple decrements on the same semaphore are pending, then the
current code scans all decrement operations, even if the semaphore value
is already 0.
The patch optimizes that: if the semaphore value is 0, then there is no
need to scan the q->alter entries.
Note that this is a common case: It happens if 100 decrements by one are
pending and now an increment by one increases the semaphore value from 0
to 1. Without this patch, all 100 entries are scanned. With the patch,
only one entry is scanned, then woken up. Then the new rule triggers and
the scanning is aborted, without looking at the remaining 99 tasks.
With this patch, single sop increment/decrement by 1 are now O(1).
(same as with Nick's patch)
Signed-off-by: Manfred Spraul <manfred@colorfullife.com>
Cc: Nick Piggin <npiggin@suse.de>
Cc: Pierre Peiffer <peifferp@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'block')
0 files changed, 0 insertions, 0 deletions