<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/ipc, branch v2.6.35</title>
<subtitle>Linux kernel source tree</subtitle>
<id>https://git.amat.us/linux/atom/ipc?h=v2.6.35</id>
<link rel='self' href='https://git.amat.us/linux/atom/ipc?h=v2.6.35'/>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/'/>
<updated>2010-07-20T23:25:40Z</updated>
<entry>
<title>ipc/sem.c: bugfix for semop() not reporting successful operation</title>
<updated>2010-07-20T23:25:40Z</updated>
<author>
<name>Manfred Spraul</name>
<email>manfred@colorfullife.com</email>
</author>
<published>2010-07-20T20:24:23Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=c61284e99191b2284fb74dae6961d4d09e4e59e8'/>
<id>urn:sha1:c61284e99191b2284fb74dae6961d4d09e4e59e8</id>
<content type='text'>
The last change to improve the scalability moved the actual wake-up out of
the section that is protected by spin_lock(sma-&gt;sem_perm.lock).

This means that IN_WAKEUP can be in queue.status even when the spinlock is
acquired by the current task.  Thus the same loop that is performed when
queue.status is read without the spinlock acquired must be performed when
the spinlock is acquired.

Thanks to kamezawa.hiroyu@jp.fujitsu.com for noticing lack of the memory
barrier.

Addresses https://bugzilla.kernel.org/show_bug.cgi?id=16255

[akpm@linux-foundation.org: clean up kerneldoc, checkpatch warning and whitespace]
Signed-off-by: Manfred Spraul &lt;manfred@colorfullife.com&gt;
Reported-by: Luca Tettamanti &lt;kronos.it@gmail.com&gt;
Tested-by: Luca Tettamanti &lt;kronos.it@gmail.com&gt;
Reported-by: Christoph Lameter &lt;cl@linux-foundation.org&gt;
Cc: Maciej Rutecki &lt;maciej.rutecki@gmail.com&gt;
Cc: KAMEZAWA Hiroyuki &lt;kamezawa.hiroyu@jp.fujitsu.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>mqueue doesn't need make_bad_inode()</title>
<updated>2010-06-04T21:16:27Z</updated>
<author>
<name>Al Viro</name>
<email>viro@zeniv.linux.org.uk</email>
</author>
<published>2010-05-28T23:06:15Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=0abbb609ac511fc226b8b1082613193c8ecf8324'/>
<id>urn:sha1:0abbb609ac511fc226b8b1082613193c8ecf8324</id>
<content type='text'>
It never hashes them anyway and does final iput() immediately
afterwards.  With -&gt;drop_inode() being generic_delete_inode()...

Signed-off-by: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
</content>
</entry>
<entry>
<title>drop unused dentry argument to -&gt;fsync</title>
<updated>2010-05-28T02:05:02Z</updated>
<author>
<name>Christoph Hellwig</name>
<email>hch@lst.de</email>
</author>
<published>2010-05-26T15:53:25Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=7ea8085910ef3dd4f3cad6845aaa2b580d39b115'/>
<id>urn:sha1:7ea8085910ef3dd4f3cad6845aaa2b580d39b115</id>
<content type='text'>
Signed-off-by: Christoph Hellwig &lt;hch@lst.de&gt;
Signed-off-by: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
</content>
</entry>
<entry>
<title>ipc/sem.c: use ERR_CAST</title>
<updated>2010-05-27T16:12:49Z</updated>
<author>
<name>Julia Lawall</name>
<email>julia@diku.dk</email>
</author>
<published>2010-05-26T21:43:44Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=4de85cd6d6018825e19f76f1208775f23ecc393f'/>
<id>urn:sha1:4de85cd6d6018825e19f76f1208775f23ecc393f</id>
<content type='text'>
Use ERR_CAST(x) rather than ERR_PTR(PTR_ERR(x)).  The former makes more
clear what is the purpose of the operation, which otherwise looks like a
no-op.

The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)

// &lt;smpl&gt;
@@
type T;
T x;
identifier f;
@@

T f (...) { &lt;+...
- ERR_PTR(PTR_ERR(x))
+ x
 ...+&gt; }

@@
expression x;
@@

- ERR_PTR(PTR_ERR(x))
+ ERR_CAST(x)
// &lt;/smpl&gt;

Signed-off-by: Julia Lawall &lt;julia@diku.dk&gt;
Cc: Manfred Spraul &lt;manfred@colorfullife.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: update description of the implementation</title>
<updated>2010-05-27T16:12:49Z</updated>
<author>
<name>Manfred Spraul</name>
<email>manfred@colorfullife.com</email>
</author>
<published>2010-05-26T21:43:43Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=c5cf6359ad1d322c16e159011247341849cc0d3a'/>
<id>urn:sha1:c5cf6359ad1d322c16e159011247341849cc0d3a</id>
<content type='text'>
ipc/sem.c begins with a 15 year old description about bugs in the initial
implementation in Linux-1.0.  The patch replaces that with a top level
description of the current code.

A TODO could be derived from this text:

The opengroup man page for semop() does not mandate FIFO.  Thus there is
no need for a semaphore array list of pending operations.

If

- this list is removed
- the per-semaphore array spinlock is removed (possible if there is no
  list to protect)
- sem_otime is moved into the semaphores and calculated on demand during
  semctl()

then the array would be read-mostly - which would significantly improve
scaling for applications that use semaphore arrays with lots of entries.

The price would be expensive semctl() calls:

	for(i=0;i&lt;sma-&gt;sem_nsems;i++) spin_lock(sma-&gt;sem_lock);
	&lt;do stuff&gt;
	for(i=0;i&lt;sma-&gt;sem_nsems;i++) spin_unlock(sma-&gt;sem_lock);

I'm not sure if the complexity is worth the effort, thus here is the
documentation of the current behavior first.

Signed-off-by: Manfred Spraul &lt;manfred@colorfullife.com&gt;
Cc: Chris Mason &lt;chris.mason@oracle.com&gt;
Cc: Zach Brown &lt;zach.brown@oracle.com&gt;
Cc: Jens Axboe &lt;jens.axboe@oracle.com&gt;
Cc: Nick Piggin &lt;npiggin@suse.de&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: move wake_up_process out of the spinlock section</title>
<updated>2010-05-27T16:12:49Z</updated>
<author>
<name>Manfred Spraul</name>
<email>manfred@colorfullife.com</email>
</author>
<published>2010-05-26T21:43:41Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=0a2b9d4c79671b05956806ede5d054e03ae56280'/>
<id>urn:sha1:0a2b9d4c79671b05956806ede5d054e03ae56280</id>
<content type='text'>
The wake-up part of semtimedop() consists out of two steps:

- the right tasks must be identified.
- they must be woken up.

Right now, both steps run while the array spinlock is held.  This patch
reorders the code and moves the actual wake_up_process() behind the point
where the spinlock is dropped.

The code also moves setting sem-&gt;sem_otime to one place: It does not make
sense to set the last modify time multiple times.

[akpm@linux-foundation.org: repair kerneldoc]
[akpm@linux-foundation.org: fix uninitialised retval]
Signed-off-by: Manfred Spraul &lt;manfred@colorfullife.com&gt;
Cc: Chris Mason &lt;chris.mason@oracle.com&gt;
Cc: Zach Brown &lt;zach.brown@oracle.com&gt;
Cc: Jens Axboe &lt;jens.axboe@oracle.com&gt;
Cc: Nick Piggin &lt;npiggin@suse.de&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 update_queue() for bulk wakeup calls</title>
<updated>2010-05-27T16:12:49Z</updated>
<author>
<name>Manfred Spraul</name>
<email>manfred@colorfullife.com</email>
</author>
<published>2010-05-26T21:43:40Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=fd5db42254518fbf241dc454e918598fbe494fa2'/>
<id>urn:sha1:fd5db42254518fbf241dc454e918598fbe494fa2</id>
<content type='text'>
The following series of patches tries to fix the spinlock contention
reported by Chris Mason - his benchmark exposes problems of the current
code:

- In the worst case, the algorithm used by update_queue() is O(N^2).
  Bulk wake-up calls can enter this worst case.  The patch series fix
  that.

  Note that the benchmark app doesn't expose the problem, it just should
  be fixed: Real world apps might do the wake-ups in another order than
  perfect FIFO.

- The part of the code that runs within the semaphore array spinlock is
  significantly larger than necessary.

  The patch series fixes that.  This change is responsible for the main
  improvement.

- The cacheline with the spinlock is also used for a variable that is
  read in the hot path (sem_base) and for a variable that is unnecessarily
  written to multiple times (sem_otime).  The last step of the series
  cacheline-aligns the spinlock.

This patch:

The SysV semaphore code allows to perform multiple operations on all
semaphores in the array as atomic operations.  After a modification,
update_queue() checks which of the waiting tasks can complete.

The algorithm that is used to identify the tasks is O(N^2) in the worst
case.  For some cases, it is simple to avoid the O(N^2).

The patch adds a detection logic for some cases, especially for the case
of an array where all sleeping tasks are single sembuf operations and a
multi-sembuf operation is used to wake up multiple tasks.

A big database application uses that approach.

The patch fixes wakeup due to semctl(,,SETALL,) - the initial version of
the patch breaks that.

[akpm@linux-foundation.org: make do_smart_update() static]
Signed-off-by: Manfred Spraul &lt;manfred@colorfullife.com&gt;
Cc: Chris Mason &lt;chris.mason@oracle.com&gt;
Cc: Zach Brown &lt;zach.brown@oracle.com&gt;
Cc: Jens Axboe &lt;jens.axboe@oracle.com&gt;
Cc: Nick Piggin &lt;npiggin@suse.de&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>kernel-wide: replace USHORT_MAX, SHORT_MAX and SHORT_MIN with USHRT_MAX, SHRT_MAX and SHRT_MIN</title>
<updated>2010-05-25T15:07:02Z</updated>
<author>
<name>Alexey Dobriyan</name>
<email>adobriyan@gmail.com</email>
</author>
<published>2010-05-24T21:33:03Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=4be929be34f9bdeffa40d815d32d7d60d2c7f03b'/>
<id>urn:sha1:4be929be34f9bdeffa40d815d32d7d60d2c7f03b</id>
<content type='text'>
- C99 knows about USHRT_MAX/SHRT_MAX/SHRT_MIN, not
  USHORT_MAX/SHORT_MAX/SHORT_MIN.

- Make SHRT_MIN of type s16, not int, for consistency.

[akpm@linux-foundation.org: fix drivers/dma/timb_dma.c]
[akpm@linux-foundation.org: fix security/keys/keyring.c]
Signed-off-by: Alexey Dobriyan &lt;adobriyan@gmail.com&gt;
Acked-by: WANG Cong &lt;xiyou.wangcong@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>Merge branch 'timers-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip</title>
<updated>2010-05-20T00:11:10Z</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2010-05-20T00:11:10Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=164d44fd92e79d5bce54d0d62df9f856f7b23925'/>
<id>urn:sha1:164d44fd92e79d5bce54d0d62df9f856f7b23925</id>
<content type='text'>
* 'timers-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
  clocksource: Add clocksource_register_hz/khz interface
  posix-cpu-timers: Optimize run_posix_cpu_timers()
  time: Remove xtime_cache
  mqueue: Convert message queue timeout to use hrtimers
  hrtimers: Provide schedule_hrtimeout for CLOCK_REALTIME
  timers: Introduce the concept of timer slack for legacy timers
  ntp: Remove tickadj
  ntp: Make time_adjust static
  time: Add xtime, wall_to_monotonic to feature-removal-schedule
  timer: Try to survive timer callback preempt_count leak
  timer: Split out timer function call
  timer: Print function name for timer callbacks modifying preemption count
  time: Clean up warp_clock()
  cpu-timers: Avoid iterating over all threads in fastpath_timer_check()
  cpu-timers: Change SIGEV_NONE timer implementation
  cpu-timers: Return correct previous timer reload value
  cpu-timers: Cleanup arm_timer()
  cpu-timers: Simplify RLIMIT_CPU handling
</content>
</entry>
<entry>
<title>mqueue: fix kernel BUG caused by double free() on mq_open()</title>
<updated>2010-05-12T00:33:42Z</updated>
<author>
<name>André Goddard Rosa</name>
<email>andre.goddard@gmail.com</email>
</author>
<published>2010-05-11T21:07:03Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=a3ed2a15719219769bb095b28009c1d654a419e8'/>
<id>urn:sha1:a3ed2a15719219769bb095b28009c1d654a419e8</id>
<content type='text'>
In case of aborting because we reach the maximum amount of memory which
can be allocated to message queues per user (RLIMIT_MSGQUEUE), we would
try to free the message area twice when bailing out: first by the error
handling code itself, and then later when cleaning up the inode through
delete_inode().

Signed-off-by: André Goddard Rosa &lt;andre.goddard@gmail.com&gt;
Cc: Alexey Dobriyan &lt;adobriyan@gmail.com&gt;
Cc: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
Cc: &lt;stable@kernel.org&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>
</feed>
