<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux.git/fs/eventpoll.c, branch v2.6.25</title>
<subtitle>Linux kernel source tree</subtitle>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/'/>
<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.tavy.me/linux.git/commit/?id=0ccf831cbee94df9c5006dd46248c0f07847dd7c'/>
<id>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>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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;
</pre>
</div>
</content>
</entry>
<entry>
<title>Use wake_up_locked() in eventpoll</title>
<updated>2007-12-06T22:07:16+00:00</updated>
<author>
<name>Matthew Wilcox</name>
<email>matthew@wil.cx</email>
</author>
<published>2007-08-30T20:10:22+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=4a6e9e2ce822c9f597b3036887f6cf5fa3a79375'/>
<id>4a6e9e2ce822c9f597b3036887f6cf5fa3a79375</id>
<content type='text'>
Replace the uses of __wake_up_locked with wake_up_locked

Signed-off-by: Matthew Wilcox &lt;matthew@wil.cx&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Replace the uses of __wake_up_locked with wake_up_locked

Signed-off-by: Matthew Wilcox &lt;matthew@wil.cx&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>fs/eventpoll.c: use list_for_each_entry() instead of list_for_each()</title>
<updated>2007-10-19T18:53:38+00:00</updated>
<author>
<name>Matthias Kaehlcke</name>
<email>matthias.kaehlcke@gmail.com</email>
</author>
<published>2007-10-19T06:39:56+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=b70c394099851c1398e9fd0fd64cf13ef2d093a1'/>
<id>b70c394099851c1398e9fd0fd64cf13ef2d093a1</id>
<content type='text'>
fs/eventpoll.c: use list_for_each_entry() instead of list_for_each()
in ep_poll_safewake()

Signed-off-by: Matthias Kaehlcke &lt;matthias.kaehlcke@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>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
fs/eventpoll.c: use list_for_each_entry() instead of list_for_each()
in ep_poll_safewake()

Signed-off-by: Matthias Kaehlcke &lt;matthias.kaehlcke@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;
</pre>
</div>
</content>
</entry>
<entry>
<title>sparse pointer use of zero as null</title>
<updated>2007-10-18T21:37:31+00:00</updated>
<author>
<name>Stephen Hemminger</name>
<email>shemminger@linux-foundation.org</email>
</author>
<published>2007-10-18T10:07:05+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=c80544dc0b87bb65038355e7aafdc30be16b26ab'/>
<id>c80544dc0b87bb65038355e7aafdc30be16b26ab</id>
<content type='text'>
Get rid of sparse related warnings from places that use integer as NULL
pointer.

[akpm@linux-foundation.org: coding-style fixes]
Signed-off-by: Stephen Hemminger &lt;shemminger@linux-foundation.org&gt;
Cc: Andi Kleen &lt;ak@suse.de&gt;
Cc: Jeff Garzik &lt;jeff@garzik.org&gt;
Cc: Matt Mackall &lt;mpm@selenic.com&gt;
Cc: Ian Kent &lt;raven@themaw.net&gt;
Cc: Arnd Bergmann &lt;arnd@arndb.de&gt;
Cc: Davide Libenzi &lt;davidel@xmailserver.org&gt;
Cc: Stephen Smalley &lt;sds@tycho.nsa.gov&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Get rid of sparse related warnings from places that use integer as NULL
pointer.

[akpm@linux-foundation.org: coding-style fixes]
Signed-off-by: Stephen Hemminger &lt;shemminger@linux-foundation.org&gt;
Cc: Andi Kleen &lt;ak@suse.de&gt;
Cc: Jeff Garzik &lt;jeff@garzik.org&gt;
Cc: Matt Mackall &lt;mpm@selenic.com&gt;
Cc: Ian Kent &lt;raven@themaw.net&gt;
Cc: Arnd Bergmann &lt;arnd@arndb.de&gt;
Cc: Davide Libenzi &lt;davidel@xmailserver.org&gt;
Cc: Stephen Smalley &lt;sds@tycho.nsa.gov&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>mm: Remove slab destructors from kmem_cache_create().</title>
<updated>2007-07-20T01:11:58+00:00</updated>
<author>
<name>Paul Mundt</name>
<email>lethal@linux-sh.org</email>
</author>
<published>2007-07-20T01:11:58+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=20c2df83d25c6a95affe6157a4c9cac4cf5ffaac'/>
<id>20c2df83d25c6a95affe6157a4c9cac4cf5ffaac</id>
<content type='text'>
Slab destructors were no longer supported after Christoph's
c59def9f222d44bb7e2f0a559f2906191a0862d7 change. They've been
BUGs for both slab and slub, and slob never supported them
either.

This rips out support for the dtor pointer from kmem_cache_create()
completely and fixes up every single callsite in the kernel (there were
about 224, not including the slab allocator definitions themselves,
or the documentation references).

Signed-off-by: Paul Mundt &lt;lethal@linux-sh.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Slab destructors were no longer supported after Christoph's
c59def9f222d44bb7e2f0a559f2906191a0862d7 change. They've been
BUGs for both slab and slub, and slob never supported them
either.

This rips out support for the dtor pointer from kmem_cache_create()
completely and fixes up every single callsite in the kernel (there were
about 224, not including the slab allocator definitions themselves,
or the documentation references).

Signed-off-by: Paul Mundt &lt;lethal@linux-sh.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>epoll: move kfree inside ep_free</title>
<updated>2007-05-15T15:54:00+00:00</updated>
<author>
<name>Davide Libenzi</name>
<email>davidel@xmailserver.org</email>
</author>
<published>2007-05-15T08:40:57+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=f0ee9aabb0520adea5937855a9575c08a97b16e7'/>
<id>f0ee9aabb0520adea5937855a9575c08a97b16e7</id>
<content type='text'>
Move the kfree() call inside the ep_free() function.

Signed-off-by: Davide Libenzi &lt;davidel@xmailserver.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>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Move the kfree() call inside the ep_free() function.

Signed-off-by: Davide Libenzi &lt;davidel@xmailserver.org&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>epoll: fix some comments</title>
<updated>2007-05-15T15:54:00+00:00</updated>
<author>
<name>Davide Libenzi</name>
<email>davidel@xmailserver.org</email>
</author>
<published>2007-05-15T08:40:52+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=67647d0fb8bc03609d045a9cce85f7ef6d763036'/>
<id>67647d0fb8bc03609d045a9cce85f7ef6d763036</id>
<content type='text'>
Fixes some epoll code comments.

Signed-off-by: Davide Libenzi &lt;davidel@xmailserver.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>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Fixes some epoll code comments.

Signed-off-by: Davide Libenzi &lt;davidel@xmailserver.org&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>epoll locks changes and cleanups</title>
<updated>2007-05-15T15:53:59+00:00</updated>
<author>
<name>Davide Libenzi</name>
<email>davidel@xmailserver.org</email>
</author>
<published>2007-05-15T08:40:47+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=c7ea76302547f81e4583d0d7c52a1c37c6747f5d'/>
<id>c7ea76302547f81e4583d0d7c52a1c37c6747f5d</id>
<content type='text'>
Changes the rwlock to a spinlock, and drops the use-count variable.
Operations are always bound by the mutex now, so the use-count is no more
needed.  For the same reason, the rwlock can become a simple spinlock.

Signed-off-by: Davide Libenzi &lt;davidel@xmailserver.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>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Changes the rwlock to a spinlock, and drops the use-count variable.
Operations are always bound by the mutex now, so the use-count is no more
needed.  For the same reason, the rwlock can become a simple spinlock.

Signed-off-by: Davide Libenzi &lt;davidel@xmailserver.org&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>fix epoll single pass code and add wait-exclusive flag</title>
<updated>2007-05-15T15:53:59+00:00</updated>
<author>
<name>Davide Libenzi</name>
<email>davidel@xmailserver.org</email>
</author>
<published>2007-05-15T08:40:41+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=d47de16c7221968d3eab899d7540efa5ba77af5a'/>
<id>d47de16c7221968d3eab899d7540efa5ba77af5a</id>
<content type='text'>
Fixes the epoll single pass code.  During the unlocked event delivery (to
userspace) code, the poll callback can re-issue new events, and we must
receive them correctly.  Since we loop in a lockless fashion, we want to be
O(nready), and we don't want to flash on/off the spinlock for every event, we
have the poll callback to use a secondary list to queue events while we're
inside the event delivery loop.  The rw_semaphore has been turned into a
mutex.  This patch also adds the wait-exclusive flag, as suggested by Davi
Arnaut.

Signed-off-by: Davide Libenzi &lt;davidel@xmailserver.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>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Fixes the epoll single pass code.  During the unlocked event delivery (to
userspace) code, the poll callback can re-issue new events, and we must
receive them correctly.  Since we loop in a lockless fashion, we want to be
O(nready), and we don't want to flash on/off the spinlock for every event, we
have the poll callback to use a secondary list to queue events while we're
inside the event delivery loop.  The rw_semaphore has been turned into a
mutex.  This patch also adds the wait-exclusive flag, as suggested by Davi
Arnaut.

Signed-off-by: Davide Libenzi &lt;davidel@xmailserver.org&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>epoll cleanups: epoll remove static pre-declarations and akpm-ize the code</title>
<updated>2007-05-11T15:29:37+00:00</updated>
<author>
<name>Davide Libenzi</name>
<email>davidel@xmailserver.org</email>
</author>
<published>2007-05-11T05:23:23+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=7699acd1341c63fdbcfc56994fb2989ec59d2a43'/>
<id>7699acd1341c63fdbcfc56994fb2989ec59d2a43</id>
<content type='text'>
Re-arrange epoll code to avoid static functions pre-declarations, and apply
akpm-filter on it.

Signed-off-by: Davide Libenzi &lt;davidel@xmailserver.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>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Re-arrange epoll code to avoid static functions pre-declarations, and apply
akpm-filter on it.

Signed-off-by: Davide Libenzi &lt;davidel@xmailserver.org&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</pre>
</div>
</content>
</entry>
</feed>
