<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/linux.git/include/linux/wait.h, branch linux-2.6.28.y</title>
<subtitle>Linux kernel stable tree (mirror)</subtitle>
<id>https://git.radix-linux.su/kernel/linux.git/atom?h=linux-2.6.28.y</id>
<link rel='self' href='https://git.radix-linux.su/kernel/linux.git/atom?h=linux-2.6.28.y'/>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/'/>
<updated>2009-02-12T17:50:23+00:00</updated>
<entry>
<title>wait: prevent exclusive waiter starvation</title>
<updated>2009-02-12T17:50:23+00:00</updated>
<author>
<name>Johannes Weiner</name>
<email>hannes@cmpxchg.org</email>
</author>
<published>2009-02-04T23:12:14+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=12585ca5d984a0b27baf6a397cd6d59d9e82ef4c'/>
<id>urn:sha1:12585ca5d984a0b27baf6a397cd6d59d9e82ef4c</id>
<content type='text'>
commit 777c6c5f1f6e757ae49ecca2ed72d6b1f523c007 upstream.

With exclusive waiters, every process woken up through the wait queue must
ensure that the next waiter down the line is woken when it has finished.

Interruptible waiters don't do that when aborting due to a signal.  And if
an aborting waiter is concurrently woken up through the waitqueue, noone
will ever wake up the next waiter.

This has been observed with __wait_on_bit_lock() used by
lock_page_killable(): the first contender on the queue was aborting when
the actual lock holder woke it up concurrently.  The aborted contender
didn't acquire the lock and therefor never did an unlock followed by
waking up the next waiter.

Add abort_exclusive_wait() which removes the process' wait descriptor from
the waitqueue, iff still queued, or wakes up the next waiter otherwise.
It does so under the waitqueue lock.  Racing with a wake up means the
aborting process is either already woken (removed from the queue) and will
wake up the next waiter, or it will remove itself from the queue and the
concurrent wake up will apply to the next waiter after it.

Use abort_exclusive_wait() in __wait_event_interruptible_exclusive() and
__wait_on_bit_lock() when they were interrupted by other means than a wake
up through the queue.

[akpm@linux-foundation.org: coding-style fixes]
Reported-by: Chris Mason &lt;chris.mason@oracle.com&gt;
Signed-off-by: Johannes Weiner &lt;hannes@cmpxchg.org&gt;
Mentored-by: Oleg Nesterov &lt;oleg@redhat.com&gt;
Cc: Peter Zijlstra &lt;a.p.zijlstra@chello.nl&gt;
Cc: Matthew Wilcox &lt;matthew@wil.cx&gt;
Cc: Chuck Lever &lt;cel@citi.umich.edu&gt;
Cc: Nick Piggin &lt;nickpiggin@yahoo.com.au&gt;
Cc: Ingo Molnar &lt;mingo@elte.hu&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;

</content>
</entry>
<entry>
<title>wait: kill is_sync_wait()</title>
<updated>2008-10-16T18:21:31+00:00</updated>
<author>
<name>Tejun Heo</name>
<email>tj@kernel.org</email>
</author>
<published>2008-10-16T05:01:38+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=a25d644fc0e232f242d1f3baa63c149c42536ff0'/>
<id>urn:sha1:a25d644fc0e232f242d1f3baa63c149c42536ff0</id>
<content type='text'>
is_sync_wait() is used to distinguish between sync and async waits.
Basically sync waits are the ones initialized with init_waitqueue_entry()
and async ones with init_waitqueue_func_entry().  The sync/async
distinction is used only in prepare_to_wait[_exclusive]() and its only
function is to skip setting the current task state if the wait is async.
This has a few problems.

* No one uses it.  None of func_entry users use prepare_to_wait()
  functions, so the code path never gets executed.

* The distinction is bogus.  Maybe back when func_entry is used only
  by aio but it's now also used by epoll and in future possibly by 9p
  and poll/select.

* Taking @state as argument and ignoring it silenly depending on how
  @wait is initialized is just a bad error-prone API.

* It prevents func_entry waits from using wait-&gt;private for no good
  reason.

This patch kills is_sync_wait() and the associated code paths from
prepare_to_wait[_exclusive]().  As there was no user of these code paths,
this patch doesn't cause any behavior difference.

Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
Acked-by: Ingo Molnar &lt;mingo@elte.hu&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>include/linux: Remove all users of FASTCALL() macro</title>
<updated>2008-02-14T00:21:18+00:00</updated>
<author>
<name>Harvey Harrison</name>
<email>harvey.harrison@gmail.com</email>
</author>
<published>2008-02-13T23:03:15+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=b3c97528689619fc66569b30bf83d09d9929521a'/>
<id>urn:sha1:b3c97528689619fc66569b30bf83d09d9929521a</id>
<content type='text'>
FASTCALL() is always expanded to empty, remove it.

[akpm@linux-foundation.org: coding-style fixes]
Signed-off-by: Harvey Harrison &lt;harvey.harrison@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>lockdep: annotate epoll</title>
<updated>2008-02-05T17:44:07+00:00</updated>
<author>
<name>Peter Zijlstra</name>
<email>a.p.zijlstra@chello.nl</email>
</author>
<published>2008-02-05T06:27:20+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=0ccf831cbee94df9c5006dd46248c0f07847dd7c'/>
<id>urn:sha1:0ccf831cbee94df9c5006dd46248c0f07847dd7c</id>
<content type='text'>
On Sat, 2008-01-05 at 13:35 -0800, Davide Libenzi wrote:

&gt; I remember I talked with Arjan about this time ago. Basically, since 1)
&gt; you can drop an epoll fd inside another epoll fd 2) callback-based wakeups
&gt; are used, you can see a wake_up() from inside another wake_up(), but they
&gt; will never refer to the same lock instance.
&gt; Think about:
&gt;
&gt; 	dfd = socket(...);
&gt; 	efd1 = epoll_create();
&gt; 	efd2 = epoll_create();
&gt; 	epoll_ctl(efd1, EPOLL_CTL_ADD, dfd, ...);
&gt; 	epoll_ctl(efd2, EPOLL_CTL_ADD, efd1, ...);
&gt;
&gt; When a packet arrives to the device underneath "dfd", the net code will
&gt; issue a wake_up() on its poll wake list. Epoll (efd1) has installed a
&gt; callback wakeup entry on that queue, and the wake_up() performed by the
&gt; "dfd" net code will end up in ep_poll_callback(). At this point epoll
&gt; (efd1) notices that it may have some event ready, so it needs to wake up
&gt; the waiters on its poll wait list (efd2). So it calls ep_poll_safewake()
&gt; that ends up in another wake_up(), after having checked about the
&gt; recursion constraints. That are, no more than EP_MAX_POLLWAKE_NESTS, to
&gt; avoid stack blasting. Never hit the same queue, to avoid loops like:
&gt;
&gt; 	epoll_ctl(efd2, EPOLL_CTL_ADD, efd1, ...);
&gt; 	epoll_ctl(efd3, EPOLL_CTL_ADD, efd2, ...);
&gt; 	epoll_ctl(efd4, EPOLL_CTL_ADD, efd3, ...);
&gt; 	epoll_ctl(efd1, EPOLL_CTL_ADD, efd4, ...);
&gt;
&gt; The code "if (tncur-&gt;wq == wq || ..." prevents re-entering the same
&gt; queue/lock.

Since the epoll code is very careful to not nest same instance locks
allow the recursion.

Signed-off-by: Peter Zijlstra &lt;a.p.zijlstra@chello.nl&gt;
Tested-by: Stefan Richter &lt;stefanr@s5r6.in-berlin.de&gt;
Acked-by: Davide Libenzi &lt;davidel@xmailserver.org&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>
<entry>
<title>Add wait_event_killable</title>
<updated>2007-12-06T22:40:14+00:00</updated>
<author>
<name>Matthew Wilcox</name>
<email>matthew@wil.cx</email>
</author>
<published>2007-12-06T17:00:00+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=1411d5a7fbe7dce1568b6f0a94c7cbc69eed1bfe'/>
<id>urn:sha1:1411d5a7fbe7dce1568b6f0a94c7cbc69eed1bfe</id>
<content type='text'>
Signed-off-by: Matthew Wilcox &lt;willy@linux.intel.com&gt;
</content>
</entry>
<entry>
<title>wait: Use TASK_NORMAL</title>
<updated>2007-12-06T22:34:36+00:00</updated>
<author>
<name>Matthew Wilcox</name>
<email>matthew@wil.cx</email>
</author>
<published>2007-12-06T22:34:36+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=e64d66c8edf11629aa203328daf898775ee27dd4'/>
<id>urn:sha1:e64d66c8edf11629aa203328daf898775ee27dd4</id>
<content type='text'>
Also move wake_up_locked() to be with the related functions

Signed-off-by: Matthew Wilcox &lt;willy@linux.intel.com&gt;
</content>
</entry>
<entry>
<title>sched: clean up sleep_on() APIs</title>
<updated>2007-07-09T16:52:01+00:00</updated>
<author>
<name>Ingo Molnar</name>
<email>mingo@elte.hu</email>
</author>
<published>2007-07-09T16:52:01+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=0fec171cdbd7763ef86cbaccb91f3708de6a9003'/>
<id>urn:sha1:0fec171cdbd7763ef86cbaccb91f3708de6a9003</id>
<content type='text'>
clean up the sleep_on() APIs:

 - do not use fastcall
 - replace fragile macro magic with proper inline functions

Signed-off-by: Ingo Molnar &lt;mingo@elte.hu&gt;
</content>
</entry>
<entry>
<title>[PATCH] lockdep: annotate DECLARE_WAIT_QUEUE_HEAD</title>
<updated>2006-10-30T20:08:40+00:00</updated>
<author>
<name>Peter Zijlstra</name>
<email>a.p.zijlstra@chello.nl</email>
</author>
<published>2006-10-30T06:46:36+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=7259f0d05d595b73ef312a082e628627c6414969'/>
<id>urn:sha1:7259f0d05d595b73ef312a082e628627c6414969</id>
<content type='text'>
kernel: INFO: trying to register non-static key.
kernel: the code is fine but needs lockdep annotation.
kernel: turning off the locking correctness validator.
kernel:  [&lt;c04051ed&gt;] show_trace_log_lvl+0x58/0x16a
kernel:  [&lt;c04057fa&gt;] show_trace+0xd/0x10
kernel:  [&lt;c0405913&gt;] dump_stack+0x19/0x1b
kernel:  [&lt;c043b1e2&gt;] __lock_acquire+0xf0/0x90d
kernel:  [&lt;c043bf70&gt;] lock_acquire+0x4b/0x6b
kernel:  [&lt;c061472f&gt;] _spin_lock_irqsave+0x22/0x32
kernel:  [&lt;c04363d3&gt;] prepare_to_wait+0x17/0x4b
kernel:  [&lt;f89a24b6&gt;] lpfc_do_work+0xdd/0xcc2 [lpfc]
kernel:  [&lt;c04361b9&gt;] kthread+0xc3/0xf2
kernel:  [&lt;c0402005&gt;] kernel_thread_helper+0x5/0xb

Another case of non-static lockdep keys; duplicate the paradigm set by
DECLARE_COMPLETION_ONSTACK and introduce DECLARE_WAIT_QUEUE_HEAD_ONSTACK.

Signed-off-by: Peter Zijlstra &lt;a.p.zijlstra@chello.nl&gt;
Cc: Greg KH &lt;gregkh@suse.de&gt;
Cc: Markus Lidel &lt;markus.lidel@shadowconnect.com&gt;
Acked-by: Ingo Molnar &lt;mingo@elte.hu&gt;
Cc: Arjan van de Ven &lt;arjan@infradead.org&gt;
Cc: James Bottomley &lt;James.Bottomley@steeleye.com&gt;
Cc: Marcel Holtmann &lt;marcel@holtmann.org&gt;
Signed-off-by: Andrew Morton &lt;akpm@osdl.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@osdl.org&gt;
</content>
</entry>
<entry>
<title>[PATCH] uninline init_waitqueue_head()</title>
<updated>2006-07-10T20:24:25+00:00</updated>
<author>
<name>Ingo Molnar</name>
<email>mingo@elte.hu</email>
</author>
<published>2006-07-10T11:45:32+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=21d71f513b6221f482ed6ad45e05f073ae67f319'/>
<id>urn:sha1:21d71f513b6221f482ed6ad45e05f073ae67f319</id>
<content type='text'>
allyesconfig vmlinux size delta:

  text            data    bss     dec          filename
  20736884        6073834 3075176 29885894     vmlinux.before
  20721009        6073966 3075176 29870151     vmlinux.after

~18 bytes per callsite, 15K of text size (~0.1%) saved.

(as an added bonus this also removes a lockdep annotation.)

Signed-off-by: Ingo Molnar &lt;mingo@elte.hu&gt;
Signed-off-by: Andrew Morton &lt;akpm@osdl.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@osdl.org&gt;
</content>
</entry>
<entry>
<title>[PATCH] lockdep: annotate waitqueues</title>
<updated>2006-07-03T22:27:07+00:00</updated>
<author>
<name>Ingo Molnar</name>
<email>mingo@elte.hu</email>
</author>
<published>2006-07-03T07:25:07+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=eb4542b98c81e22e08587b747b21986a45360999'/>
<id>urn:sha1:eb4542b98c81e22e08587b747b21986a45360999</id>
<content type='text'>
Create one lock class for all waitqueue locks in the kernel.  Has no effect on
non-lockdep kernels.

Signed-off-by: Ingo Molnar &lt;mingo@elte.hu&gt;
Signed-off-by: Arjan van de Ven &lt;arjan@linux.intel.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@osdl.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@osdl.org&gt;
</content>
</entry>
</feed>
