<feed xmlns='http://www.w3.org/2005/Atom'>
<title>user/sven/linux.git/include/linux/list.h, branch v4.0</title>
<subtitle>Linux Kernel
</subtitle>
<id>https://git.stealer.net/cgit.cgi/user/sven/linux.git/atom?h=v4.0</id>
<link rel='self' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/atom?h=v4.0'/>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/'/>
<updated>2014-11-20T13:45:15Z</updated>
<entry>
<title>Replace mentions of "list_struct" to "list_head"</title>
<updated>2014-11-20T13:45:15Z</updated>
<author>
<name>Andrey Utkin</name>
<email>andrey.krieger.utkin@gmail.com</email>
</author>
<published>2014-11-14T01:09:55Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=3943f42c11896ce82ad3da132c8a5630313bdd0e'/>
<id>urn:sha1:3943f42c11896ce82ad3da132c8a5630313bdd0e</id>
<content type='text'>
There's no such thing as "list_struct".

Signed-off-by: Andrey Utkin &lt;andrey.krieger.utkin@gmail.com&gt;
Acked-by: Steven Rostedt &lt;rostedt@goodmis.org&gt;
Acked-by: Mauro Carvalho Chehab &lt;mchehab@osg.samsung.com&gt;
Acked-by: Paul E. McKenney &lt;paulmck@linux.vnet.ibm.com&gt;
Acked-by: Alex Deucher &lt;alexander.deucher@amd.com&gt;
Signed-off-by: Jiri Kosina &lt;jkosina@suse.cz&gt;
</content>
</entry>
<entry>
<title>list: include linux/kernel.h</title>
<updated>2014-10-14T00:18:13Z</updated>
<author>
<name>Masahiro Yamada</name>
<email>yamada.m@jp.panasonic.com</email>
</author>
<published>2014-10-13T22:51:30Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=8b21d9ca17ff8ed0dbf650f4162ee2d59bb5a881'/>
<id>urn:sha1:8b21d9ca17ff8ed0dbf650f4162ee2d59bb5a881</id>
<content type='text'>
linux/list.h uses container_of, therefore it depends on linux/kernel.h.

Signed-off-by: Masahiro Yamada &lt;yamada.m@jp.panasonic.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>list: fix order of arguments for hlist_add_after(_rcu)</title>
<updated>2014-08-07T01:01:24Z</updated>
<author>
<name>Ken Helias</name>
<email>kenhelias@firemail.de</email>
</author>
<published>2014-08-06T23:09:16Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=1d023284c31a4e40a94d5bbcb7dbb7a35ee0bcbc'/>
<id>urn:sha1:1d023284c31a4e40a94d5bbcb7dbb7a35ee0bcbc</id>
<content type='text'>
All other add functions for lists have the new item as first argument
and the position where it is added as second argument.  This was changed
for no good reason in this function and makes using it unnecessary
confusing.

The name was changed to hlist_add_behind() to cause unconverted code to
generate a compile error instead of using the wrong parameter order.

[akpm@linux-foundation.org: coding-style fixes]
Signed-off-by: Ken Helias &lt;kenhelias@firemail.de&gt;
Cc: "Paul E. McKenney" &lt;paulmck@linux.vnet.ibm.com&gt;
Acked-by: Jeff Kirsher &lt;jeffrey.t.kirsher@intel.com&gt;	[intel driver bits]
Cc: Hugh Dickins &lt;hughd@google.com&gt;
Cc: Christoph Hellwig &lt;hch@infradead.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>list: make hlist_add_after() argument names match hlist_add_after_rcu()</title>
<updated>2014-08-07T01:01:24Z</updated>
<author>
<name>Ken Helias</name>
<email>kenhelias@firemail.de</email>
</author>
<published>2014-08-06T23:09:14Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=bc18dd335a161f9229ed3aaab88ce0706cbd9867'/>
<id>urn:sha1:bc18dd335a161f9229ed3aaab88ce0706cbd9867</id>
<content type='text'>
The argument names for hlist_add_after() are poorly chosen because they
look the same as the ones for hlist_add_before() but have to be used
differently.

hlist_add_after_rcu() has made a better choice.

Signed-off-by: Ken Helias &lt;kenhelias@firemail.de&gt;
Cc: "Paul E. McKenney" &lt;paulmck@linux.vnet.ibm.com&gt;
Cc: Christoph Hellwig &lt;hch@infradead.org&gt;
Cc: Hugh Dickins &lt;hughd@google.com&gt;
Cc: Jeff Kirsher &lt;jeffrey.t.kirsher@intel.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>list: introduce list_last_entry(), use list_{first,last}_entry()</title>
<updated>2013-11-13T03:09:24Z</updated>
<author>
<name>Oleg Nesterov</name>
<email>oleg@redhat.com</email>
</author>
<published>2013-11-12T23:10:03Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=93be3c2eb3371f022ad88acf1ab6bee8e3c38378'/>
<id>urn:sha1:93be3c2eb3371f022ad88acf1ab6bee8e3c38378</id>
<content type='text'>
We already have list_first_entry(), it makes sense to also add
list_last_entry() for consistency.  And we use both helpers in
list_for_each_*().

Signed-off-by: Oleg Nesterov &lt;oleg@redhat.com&gt;
Cc: Eilon Greenstein &lt;eilong@broadcom.com&gt;
Cc: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
Cc: Peter Zijlstra &lt;a.p.zijlstra@chello.nl&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>list: change list_for_each_entry*() to use list_*_entry()</title>
<updated>2013-11-13T03:09:23Z</updated>
<author>
<name>Oleg Nesterov</name>
<email>oleg@redhat.com</email>
</author>
<published>2013-11-12T23:10:02Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=8120e2e5141a420edee725ff28f18aa264795f7a'/>
<id>urn:sha1:8120e2e5141a420edee725ff28f18aa264795f7a</id>
<content type='text'>
Now that we have list_{next,prev}_entry() we can change
list_for_each_entry*() and list_safe_reset_next() to use the new helpers
to improve the readability.

Signed-off-by: Oleg Nesterov &lt;oleg@redhat.com&gt;
Cc: Eilon Greenstein &lt;eilong@broadcom.com&gt;
Cc: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
Cc: Peter Zijlstra &lt;a.p.zijlstra@chello.nl&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>list: introduce list_next_entry() and list_prev_entry()</title>
<updated>2013-11-13T03:09:23Z</updated>
<author>
<name>Oleg Nesterov</name>
<email>oleg@redhat.com</email>
</author>
<published>2013-11-12T23:10:01Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=008208c6b26f21c2648c250a09c55e737c02c5f8'/>
<id>urn:sha1:008208c6b26f21c2648c250a09c55e737c02c5f8</id>
<content type='text'>
Add two trivial helpers list_next_entry() and list_prev_entry(), they
can have a lot of users including list.h itself.  In fact the 1st one is
already defined in events/core.c and bnx2x_sp.c, so the patch simply
moves the definition to list.h.

Signed-off-by: Oleg Nesterov &lt;oleg@redhat.com&gt;
Cc: Eilon Greenstein &lt;eilong@broadcom.com&gt;
Cc: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
Cc: Peter Zijlstra &lt;a.p.zijlstra@chello.nl&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>linked-list: Remove __list_for_each</title>
<updated>2013-07-17T05:00:14Z</updated>
<author>
<name>Dave Jones</name>
<email>davej@redhat.com</email>
</author>
<published>2013-07-17T02:44:08Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=c0d15cc7ee8c0d1970197d9eb1727503bcdd2471'/>
<id>urn:sha1:c0d15cc7ee8c0d1970197d9eb1727503bcdd2471</id>
<content type='text'>
__list_for_each used to be the non prefetch() aware list walking
primitive.  When we removed the prefetch macros from the list routines,
it became redundant.  Given it does exactly the same thing as
list_for_each now, we might as well remove it and call list_for_each
directly.

All users of __list_for_each have been converted to list_for_each calls
in the current merge window.

Signed-off-by: Dave Jones &lt;davej@redhat.com&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>list: introduce list_first_entry_or_null</title>
<updated>2013-06-01T00:31:52Z</updated>
<author>
<name>Jiri Pirko</name>
<email>jiri@resnulli.us</email>
</author>
<published>2013-05-29T05:02:56Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=6d7581e62f8be462440d7b22c6361f7c9fa4902b'/>
<id>urn:sha1:6d7581e62f8be462440d7b22c6361f7c9fa4902b</id>
<content type='text'>
non-rcu variant of list_first_or_null_rcu

Signed-off-by: Jiri Pirko &lt;jiri@resnulli.us&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>list: Fix double fetch of pointer in hlist_entry_safe()</title>
<updated>2013-03-14T20:18:30Z</updated>
<author>
<name>Paul E. McKenney</name>
<email>paulmck@linux.vnet.ibm.com</email>
</author>
<published>2013-03-09T15:38:41Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=f65846a1800ef8c48d1ae1973c30dae4c356a800'/>
<id>urn:sha1:f65846a1800ef8c48d1ae1973c30dae4c356a800</id>
<content type='text'>
The current version of hlist_entry_safe() fetches the pointer twice,
once to test for NULL and the other to compute the offset back to the
enclosing structure.  This is OK for normal lock-based use because in
that case, the pointer cannot change.  However, when the pointer is
protected by RCU (as in "rcu_dereference(p)"), then the pointer can
change at any time.  This use case can result in the following sequence
of events:

1.	CPU 0 invokes hlist_entry_safe(), fetches the RCU-protected
	pointer as sees that it is non-NULL.

2.	CPU 1 invokes hlist_del_rcu(), deleting the entry that CPU 0
	just fetched a pointer to.  Because this is the last entry
	in the list, the pointer fetched by CPU 0 is now NULL.

3.	CPU 0 refetches the pointer, obtains NULL, and then gets a
	NULL-pointer crash.

This commit therefore applies gcc's "({ })" statement expression to
create a temporary variable so that the specified pointer is fetched
only once, avoiding the above sequence of events.  Please note that
it is the caller's responsibility to use rcu_dereference() as needed.
This allows RCU-protected uses to work correctly without imposing
any additional overhead on the non-RCU case.

Many thanks to Eric Dumazet for spotting root cause!

Reported-by: CAI Qian &lt;caiqian@redhat.com&gt;
Reported-by: Eric Dumazet &lt;eric.dumazet@gmail.com&gt;
Signed-off-by: Paul E. McKenney &lt;paulmck@linux.vnet.ibm.com&gt;
Tested-by: Li Zefan &lt;lizefan@huawei.com&gt;
</content>
</entry>
</feed>
