<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/ipc/sem.c, branch v2.6.34</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/
</subtitle>
<id>https://git.shady.money/linux/atom?h=v2.6.34</id>
<link rel='self' href='https://git.shady.money/linux/atom?h=v2.6.34'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/'/>
<updated>2009-12-16T15:20:10Z</updated>
<entry>
<title>ipc: remove unreachable code in sem.c</title>
<updated>2009-12-16T15:20:10Z</updated>
<author>
<name>Amerigo Wang</name>
<email>amwang@redhat.com</email>
</author>
<published>2009-12-16T00:47:35Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=e5cc9c7b1a3e7ae4d700d9fce168fb597bcfe9b6'/>
<id>urn:sha1:e5cc9c7b1a3e7ae4d700d9fce168fb597bcfe9b6</id>
<content type='text'>
This line is unreachable, remove it.

[akpm@linux-foundation.org: remove unneeded initialisation of `err']
Signed-off-by: WANG Cong &lt;amwang@redhat.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>ipc/sem.c: optimize single sops when semval is zero</title>
<updated>2009-12-16T15:20:10Z</updated>
<author>
<name>Manfred Spraul</name>
<email>manfred@colorfullife.com</email>
</author>
<published>2009-12-16T00:47:34Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=d987f8b213f2cdcc52b2ca9ee67161516e4d256a'/>
<id>urn:sha1:d987f8b213f2cdcc52b2ca9ee67161516e4d256a</id>
<content type='text'>
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-&gt;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 &lt;manfred@colorfullife.com&gt;
Cc: Nick Piggin &lt;npiggin@suse.de&gt;
Cc: Pierre Peiffer &lt;peifferp@gmail.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>ipc/sem.c: optimize single semop operations</title>
<updated>2009-12-16T15:20:10Z</updated>
<author>
<name>Manfred Spraul</name>
<email>manfred@colorfullife.com</email>
</author>
<published>2009-12-16T00:47:33Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=636c6be823870d829b37fc96655bb8820a6a9be9'/>
<id>urn:sha1:636c6be823870d829b37fc96655bb8820a6a9be9</id>
<content type='text'>
sysv sem has the concept of semaphore arrays that consist out of multiple
semaphores.  Atomic operations that affect multiple semaphores are
supported.

The patch optimizes single semaphore operation calls that affect only one
semaphore: It's not necessary to scan all pending operations, it is
sufficient to scan the per-semaphore list.

The idea is from Nick Piggin version of an ipc sem improvement, the
implementation is different: The code tries to keep as much common code as
possible.

As the result, the patch is simpler, but optimizes fewer cases.

Signed-off-by: Manfred Spraul &lt;manfred@colorfullife.com&gt;
Cc: Nick Piggin &lt;npiggin@suse.de&gt;
Cc: Pierre Peiffer &lt;peifferp@gmail.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>ipc/sem.c: add a per-semaphore pending list</title>
<updated>2009-12-16T15:20:10Z</updated>
<author>
<name>Manfred Spraul</name>
<email>manfred@colorfullife.com</email>
</author>
<published>2009-12-16T00:47:32Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=b97e820ffffbf49e94ed60c9c26f1a54bccae924'/>
<id>urn:sha1:b97e820ffffbf49e94ed60c9c26f1a54bccae924</id>
<content type='text'>
Based on Nick's findings:

sysv sem has the concept of semaphore arrays that consist out of multiple
semaphores.  Atomic operations that affect multiple semaphores are
supported.

The patch is the first step for optimizing simple, single semaphore
operations: In addition to the global list of all pending operations, a
2nd, per-semaphore list with the simple operations is added.

Note: this patch does not make sense by itself, the new list is used
nowhere.

Signed-off-by: Manfred Spraul &lt;manfred@colorfullife.com&gt;
Cc: Nick Piggin &lt;npiggin@suse.de&gt;
Cc: Pierre Peiffer &lt;peifferp@gmail.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>ipc/sem.c: optimize if semops fail</title>
<updated>2009-12-16T15:20:09Z</updated>
<author>
<name>Manfred Spraul</name>
<email>manfred@colorfullife.com</email>
</author>
<published>2009-12-16T00:47:31Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=b6e90822e77cd476c18410f7003197d466e36ac6'/>
<id>urn:sha1:b6e90822e77cd476c18410f7003197d466e36ac6</id>
<content type='text'>
Reduce the amount of scanning of the list of pending semaphore operations:
If try_atomic_semop failed, then no changes were applied.  Thus no need to
restart.

Additionally, this patch correct an incorrect comment: It's possible to
wait for arbitrary semaphore values (do a dec by &lt;x&gt;, wait-for-zero, inc
by &lt;x&gt; in one atomic operation)

Both changes are from Nick Piggin, the patch is the result of a different
split of the individual changes.

Signed-off-by: Manfred Spraul &lt;manfred@colorfullife.com&gt;
Cc: Nick Piggin &lt;npiggin@suse.de&gt;
Cc: Pierre Peiffer &lt;peifferp@gmail.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>ipc/sem.c: sem preempt improve</title>
<updated>2009-12-16T15:20:09Z</updated>
<author>
<name>Nick Piggin</name>
<email>npiggin@suse.de</email>
</author>
<published>2009-12-16T00:47:30Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=d4212093dca95c1f52197017d969cc66d5d962aa'/>
<id>urn:sha1:d4212093dca95c1f52197017d969cc66d5d962aa</id>
<content type='text'>
The strange sysv semaphore wakeup scheme has a kind of busy-wait lock
involved, which could deadlock if preemption is enabled during the "lock".

It is an implementation detail (due to a spinlock being held) that this is
actually the case.  However if "spinlocks" are made preemptible, or if the
sem lock is changed to a sleeping lock for example, then the wakeup would
become buggy.  So this might be a bugfix for -rt kernels.

Imagine waker being preempted by wakee and never clearing IN_WAKEUP -- if
wakee has higher RT priority then there is a priority inversion deadlock.
Even if there is not a priority inversion to cause a deadlock, then there
is still time wasted spinning.

Signed-off-by: Nick Piggin &lt;npiggin@suse.de&gt;
Signed-off-by: Manfred Spraul &lt;manfred@colorfullife.com&gt;
Cc: Pierre Peiffer &lt;peifferp@gmail.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>ipc/sem.c: sem use list operations</title>
<updated>2009-12-16T15:20:09Z</updated>
<author>
<name>Nick Piggin</name>
<email>npiggin@suse.de</email>
</author>
<published>2009-12-16T00:47:29Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=9cad200c7686708b326520a45dd680a4147568a6'/>
<id>urn:sha1:9cad200c7686708b326520a45dd680a4147568a6</id>
<content type='text'>
Replace the handcoded list operations in update_queue() with the standard
list_for_each_entry macros.

list_for_each_entry_safe() must be used, because list entries can
disappear immediately uppon the wakeup event.

Signed-off-by: Nick Piggin &lt;npiggin@suse.de&gt;
Signed-off-by: Manfred Spraul &lt;manfred@colorfullife.com&gt;
Cc: Pierre Peiffer &lt;peifferp@gmail.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>ipc/sem.c: sem optimise undo list search</title>
<updated>2009-12-16T15:20:09Z</updated>
<author>
<name>Nick Piggin</name>
<email>npiggin@suse.de</email>
</author>
<published>2009-12-16T00:47:28Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=bf17bb717759d50a2733a7a8157a7c4a25d93abc'/>
<id>urn:sha1:bf17bb717759d50a2733a7a8157a7c4a25d93abc</id>
<content type='text'>
Around a month ago, there was some discussion about an improvement of the
sysv sem algorithm: Most (at least: some important) users only use simple
semaphore operations, therefore it's worthwile to optimize this use case.

This patch:

Move last looked up sem_undo struct to the head of the task's undo list.
Attempt to move common entries to the front of the list so search time is
reduced.  This reduces lookup_undo on oprofile of problematic SAP workload
by 30% (see patch 4 for a description of SAP workload).

Signed-off-by: Nick Piggin &lt;npiggin@suse.de&gt;
Signed-off-by: Manfred Spraul &lt;manfred@colorfullife.com&gt;
Cc: Pierre Peiffer &lt;peifferp@gmail.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>ipc ns: fix memory leak (idr)</title>
<updated>2009-12-16T15:20:09Z</updated>
<author>
<name>Serge E. Hallyn</name>
<email>serue@us.ibm.com</email>
</author>
<published>2009-12-16T00:47:27Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=7d6feeb287c61aafa88f06345387b1188edf4b86'/>
<id>urn:sha1:7d6feeb287c61aafa88f06345387b1188edf4b86</id>
<content type='text'>
We have apparently had a memory leak since
7ca7e564e049d8b350ec9d958ff25eaa24226352 "ipc: store ipcs into IDRs" in
2007.  The idr of which 3 exist for each ipc namespace is never freed.

This patch simply frees them when the ipcns is freed.  I don't believe any
idr_remove() are done from rcu (and could therefore be delayed until after
this idr_destroy()), so the patch should be safe.  Some quick testing
showed no harm, and the memory leak fixed.

Caught by kmemleak.

Signed-off-by: Serge E. Hallyn &lt;serue@us.ibm.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>rculist: use list_entry_rcu in places where it's appropriate</title>
<updated>2009-04-15T10:05:25Z</updated>
<author>
<name>Jiri Pirko</name>
<email>jpirko@redhat.com</email>
</author>
<published>2009-04-14T18:17:16Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=05725f7eb4b8acb147c5fc7b91397b1f6bcab00d'/>
<id>urn:sha1:05725f7eb4b8acb147c5fc7b91397b1f6bcab00d</id>
<content type='text'>
Use previously introduced list_entry_rcu instead of an open-coded
list_entry + rcu_dereference combination.

Signed-off-by: Jiri Pirko &lt;jpirko@redhat.com&gt;
Reviewed-by: Paul E. McKenney &lt;paulmck@linux.vnet.ibm.com&gt;
Cc: dipankar@in.ibm.com
LKML-Reference: &lt;20090414181715.GA3634@psychotron.englab.brq.redhat.com&gt;
Signed-off-by: Ingo Molnar &lt;mingo@elte.hu&gt;
</content>
</entry>
</feed>
