Re: [PATCH 2/2] udp: RCU handling for Unicast packets.

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Eric Dumazet
Date: Wednesday, October 29, 2008 - 7:36 am

Corey Minyard a =E9crit :
rt,=20
e=20
d=20
e=20

You are absolutely right. As we *need* next pointer anyway for the prefet=
ch(),
we can store it, so that its value is kept.


Well, computing score is really cheap, everything is in cache, granted
the chain was not really huge and high score item at the beginning.

Adding yet another field in sock structure should be avoided if possible.=


Thanks

[PATCH] udp: introduce sk_for_each_rcu_safenext()

Corey Minyard found a race added in commit 271b72c7fa82c2c7a795bc16896149=
933110672d
(udp: RCU handling for Unicast packets.)

 "If the socket is moved from one list to another list in-between the tim=
e=20
  the hash is calculated and the next field is accessed, and the socket=20
  has moved to the end of the new list, the traversal will not complete=20
  properly on the list it should have, since the socket will be on the en=
d=20
  of the new list and there's not a way to tell it's on a new list and=20
  restart the list traversal.  I think that this can be solved by=20
  pre-fetching the "next" field (with proper barriers) before checking th=
e=20
  hash."

This patch corrects this problem, introducing a new sk_for_each_rcu_safen=
ext()
macro.

Signed-off-by: Eric Dumazet <dada1@cosmosbay.com>
---
 include/linux/rculist.h |   17 +++++++++++++++++
 include/net/sock.h      |    4 ++--
 net/ipv4/udp.c          |    4 ++--
 net/ipv6/udp.c          |    4 ++--
 4 files changed, 23 insertions(+), 6 deletions(-)
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH 3/3] Convert the UDP hash lock to RCU, Corey Minyard, (Mon Oct 6, 11:50 am)
Re: [PATCH 3/3] Convert the UDP hash lock to RCU, Eric Dumazet, (Mon Oct 6, 2:22 pm)
Re: [PATCH 3/3] Convert the UDP hash lock to RCU, David Miller, (Mon Oct 6, 2:40 pm)
Re: [PATCH 3/3] Convert the UDP hash lock to RCU, Corey Minyard, (Mon Oct 6, 3:07 pm)
Re: [PATCH 3/3] Convert the UDP hash lock to RCU, Corey Minyard, (Mon Oct 6, 4:08 pm)
Re: [PATCH 3/3] Convert the UDP hash lock to RCU, Eric Dumazet, (Mon Oct 6, 10:24 pm)
Re: [PATCH 3/3] Convert the UDP hash lock to RCU, Peter Zijlstra, (Tue Oct 7, 1:17 am)
Re: [PATCH 3/3] Convert the UDP hash lock to RCU, Peter Zijlstra, (Tue Oct 7, 1:31 am)
Re: [PATCH 3/3] Convert the UDP hash lock to RCU, Evgeniy Polyakov, (Tue Oct 7, 1:37 am)
Re: [PATCH 3/3] Convert the UDP hash lock to RCU, Benny Amorsen, (Tue Oct 7, 1:54 am)
Re: [PATCH 3/3] Convert the UDP hash lock to RCU, Eric Dumazet, (Tue Oct 7, 2:24 am)
Re: [PATCH 3/3] Convert the UDP hash lock to RCU, Eric Dumazet, (Tue Oct 7, 5:59 am)
Re: [PATCH 3/3] Convert the UDP hash lock to RCU, Stephen Hemminger, (Tue Oct 7, 7:07 am)
Re: [PATCH 3/3] Convert the UDP hash lock to RCU, Christoph Lameter, (Tue Oct 7, 7:15 am)
Re: [PATCH 3/3] Convert the UDP hash lock to RCU, Christoph Lameter, (Tue Oct 7, 7:16 am)
Re: [PATCH 3/3] Convert the UDP hash lock to RCU, Evgeniy Polyakov, (Tue Oct 7, 7:29 am)
Re: [PATCH 3/3] Convert the UDP hash lock to RCU, Paul E. McKenney, (Tue Oct 7, 7:33 am)
Re: [PATCH 3/3] Convert the UDP hash lock to RCU, Paul E. McKenney, (Tue Oct 7, 7:36 am)
Re: [PATCH 3/3] Convert the UDP hash lock to RCU, Paul E. McKenney, (Tue Oct 7, 7:38 am)
Re: [PATCH 3/3] Convert the UDP hash lock to RCU, Christoph Lameter, (Tue Oct 7, 7:38 am)
Re: [PATCH 3/3] Convert the UDP hash lock to RCU, Christoph Lameter, (Tue Oct 7, 7:45 am)
Re: [PATCH 3/3] Convert the UDP hash lock to RCU, Eric Dumazet, (Tue Oct 7, 7:50 am)
Re: [PATCH 3/3] Convert the UDP hash lock to RCU, Paul E. McKenney, (Tue Oct 7, 8:05 am)
Re: [PATCH 3/3] Convert the UDP hash lock to RCU, Eric Dumazet, (Tue Oct 7, 8:07 am)
Re: [PATCH 3/3] Convert the UDP hash lock to RCU, Paul E. McKenney, (Tue Oct 7, 8:07 am)
Re: [PATCH 3/3] Convert the UDP hash lock to RCU, Peter Zijlstra, (Tue Oct 7, 8:09 am)
Re: [PATCH 3/3] Convert the UDP hash lock to RCU, Christoph Lameter, (Tue Oct 7, 8:23 am)
Re: [PATCH 3/3] Convert the UDP hash lock to RCU, Corey Minyard, (Tue Oct 7, 9:43 am)
Re: [PATCH 3/3] Convert the UDP hash lock to RCU, David Miller, (Tue Oct 7, 11:26 am)
Re: [PATCH 3/3] Convert the UDP hash lock to RCU, David Miller, (Tue Oct 7, 11:29 am)
Re: [PATCH 3/3] Convert the UDP hash lock to RCU, David Miller, (Tue Oct 7, 1:55 pm)
Re: [PATCH 3/3] Convert the UDP hash lock to RCU, Stephen Hemminger, (Tue Oct 7, 2:20 pm)
Re: [PATCH 3/3] Convert the UDP hash lock to RCU, Eric Dumazet, (Wed Oct 8, 1:35 am)
Re: [PATCH 3/3] Convert the UDP hash lock to RCU, Eric Dumazet, (Wed Oct 8, 6:55 am)
Re: [PATCH 3/3] Convert the UDP hash lock to RCU, David Miller, (Wed Oct 8, 9:38 am)
Re: [PATCH 3/3] Convert the UDP hash lock to RCU, David Miller, (Wed Oct 8, 11:45 am)
[PATCH 0/2] udp: Convert the UDP hash lock to RCU, Eric Dumazet, (Tue Oct 28, 1:37 pm)
[PATCH 2/2] udp: RCU handling for Unicast packets., Eric Dumazet, (Tue Oct 28, 1:42 pm)
Re: [PATCH 0/2] udp: Convert the UDP hash lock to RCU, Stephen Hemminger, (Tue Oct 28, 2:28 pm)
Re: [PATCH 0/2] udp: Convert the UDP hash lock to RCU, Eric Dumazet, (Tue Oct 28, 2:50 pm)
Re: [PATCH 2/2] udp: RCU handling for Unicast packets., Eric Dumazet, (Tue Oct 28, 3:45 pm)
Re: [PATCH 2/2] udp: RCU handling for Unicast packets., David Miller, (Tue Oct 28, 10:05 pm)
Re: [PATCH 2/2] udp: RCU handling for Unicast packets., Eric Dumazet, (Wed Oct 29, 1:23 am)
Re: [PATCH 2/2] udp: RCU handling for Unicast packets., David Miller, (Wed Oct 29, 1:56 am)
Re: [PATCH 2/2] udp: RCU handling for Unicast packets., Eric Dumazet, (Wed Oct 29, 2:04 am)
Re: [PATCH 2/2] udp: RCU handling for Unicast packets., David Miller, (Wed Oct 29, 2:17 am)
Re: [PATCH 2/2] udp: RCU handling for Unicast packets., Eric Dumazet, (Wed Oct 29, 3:19 am)
Re: [PATCH 2/2] udp: RCU handling for Unicast packets., Corey Minyard, (Wed Oct 29, 6:17 am)
Re: [PATCH 2/2] udp: RCU handling for Unicast packets., Eric Dumazet, (Wed Oct 29, 7:36 am)
Re: [PATCH 2/2] udp: RCU handling for Unicast packets., Corey Minyard, (Wed Oct 29, 8:34 am)
Re: [PATCH 2/2] udp: RCU handling for Unicast packets., Eric Dumazet, (Wed Oct 29, 9:09 am)
Re: [PATCH 2/2] udp: RCU handling for Unicast packets., Paul E. McKenney, (Wed Oct 29, 9:37 am)
Re: [PATCH 2/2] udp: RCU handling for Unicast packets., Corey Minyard, (Wed Oct 29, 10:22 am)
Re: [PATCH 2/2] udp: RCU handling for Unicast packets., Eric Dumazet, (Wed Oct 29, 10:32 am)
Re: [PATCH 2/2] udp: RCU handling for Unicast packets., Eric Dumazet, (Wed Oct 29, 10:45 am)
Re: [PATCH 2/2] udp: RCU handling for Unicast packets., Paul E. McKenney, (Wed Oct 29, 11:11 am)
Re: [PATCH 2/2] udp: RCU handling for Unicast packets., David Miller, (Wed Oct 29, 11:19 am)
Re: [PATCH 2/2] udp: RCU handling for Unicast packets., David Miller, (Wed Oct 29, 11:20 am)
Re: [PATCH 2/2] udp: RCU handling for Unicast packets., Corey Minyard, (Wed Oct 29, 11:28 am)
Re: [PATCH 2/2] udp: RCU handling for Unicast packets., David Miller, (Wed Oct 29, 11:29 am)
Re: [PATCH 2/2] udp: RCU handling for Unicast packets., Eric Dumazet, (Wed Oct 29, 11:36 am)
Re: [PATCH 2/2] udp: RCU handling for Unicast packets., Paul E. McKenney, (Wed Oct 29, 11:38 am)
Re: [PATCH 2/2] udp: RCU handling for Unicast packets., Paul E. McKenney, (Wed Oct 29, 11:52 am)
Re: [PATCH 2/2] udp: RCU handling for Unicast packets., Eric Dumazet, (Wed Oct 29, 1:00 pm)
Re: [PATCH 2/2] udp: RCU handling for Unicast packets., Paul E. McKenney, (Wed Oct 29, 1:17 pm)
Re: [PATCH 2/2] udp: RCU handling for Unicast packets., Corey Minyard, (Wed Oct 29, 2:29 pm)
Re: [PATCH 2/2] udp: RCU handling for Unicast packets., Eric Dumazet, (Wed Oct 29, 2:57 pm)
Re: [PATCH 2/2] udp: RCU handling for Unicast packets., Paul E. McKenney, (Wed Oct 29, 2:58 pm)
Re: [PATCH 2/2] udp: RCU handling for Unicast packets., Eric Dumazet, (Wed Oct 29, 3:08 pm)
Re: [PATCH 2/2] udp: RCU handling for Unicast packets., Corey Minyard, (Wed Oct 29, 8:22 pm)
Re: [PATCH 2/2] udp: RCU handling for Unicast packets., David Miller, (Wed Oct 29, 10:40 pm)
Re: [PATCH 2/2] udp: RCU handling for Unicast packets., Eric Dumazet, (Wed Oct 29, 10:50 pm)
Re: [PATCH 2/2] udp: RCU handling for Unicast packets., Eric Dumazet, (Wed Oct 29, 10:51 pm)
Re: [PATCH 2/2] udp: RCU handling for Unicast packets., Eric Dumazet, (Thu Oct 30, 12:04 am)
Re: [PATCH 2/2] udp: RCU handling for Unicast packets., David Miller, (Thu Oct 30, 12:05 am)
Re: [PATCH 2/2] udp: RCU handling for Unicast packets., Peter Zijlstra, (Thu Oct 30, 4:04 am)
Re: [PATCH 2/2] udp: RCU handling for Unicast packets., Peter Zijlstra, (Thu Oct 30, 4:12 am)
Re: [PATCH 2/2] udp: RCU handling for Unicast packets., Eric Dumazet, (Thu Oct 30, 4:29 am)
Re: [PATCH 2/2] udp: RCU handling for Unicast packets., Eric Dumazet, (Thu Oct 30, 4:30 am)
Re: [PATCH] udp: Introduce special NULL pointers for hlist ..., Stephen Hemminger, (Thu Oct 30, 8:51 am)
Re: [PATCH 2/2] udp: RCU handling for Unicast packets., Paul E. McKenney, (Thu Oct 30, 11:25 am)
Re: [PATCH 2/2] udp: RCU handling for Unicast packets., Eric Dumazet, (Fri Oct 31, 9:40 am)
Re: [PATCH 2/2] udp: RCU handling for Unicast packets., Paul E. McKenney, (Fri Oct 31, 8:10 pm)
Re: [PATCH 2/2] udp: RCU handling for Unicast packets., David Miller, (Sat Nov 1, 9:19 pm)
[PATCH 1/3] rcu: Introduce hlist_nulls variant of hlist, Eric Dumazet, (Thu Nov 13, 6:14 am)
[PATCH 2/3] udp: Use hlist_nulls in UDP RCU code, Eric Dumazet, (Thu Nov 13, 6:15 am)
[PATCH 4/3] rcu: documents rculist_nulls, Eric Dumazet, (Thu Nov 13, 9:02 am)
Re: [PATCH 4/3] rcu: documents rculist_nulls, Peter Zijlstra, (Fri Nov 14, 8:16 am)
Re: [PATCH 4/3] rcu: documents rculist_nulls, David Miller, (Sun Nov 16, 8:36 pm)
Re: [PATCH 1/3] rcu: Introduce hlist_nulls variant of hlist, Paul E. McKenney, (Wed Nov 19, 10:01 am)
Re: [PATCH 4/3] rcu: documents rculist_nulls, Paul E. McKenney, (Wed Nov 19, 10:07 am)
Re: [PATCH 2/3] udp: Use hlist_nulls in UDP RCU code, Paul E. McKenney, (Wed Nov 19, 10:29 am)
Re: [PATCH 2/3] udp: Use hlist_nulls in UDP RCU code, Eric Dumazet, (Wed Nov 19, 10:53 am)
Re: [PATCH 1/3] rcu: Introduce hlist_nulls variant of hlist, Paul E. McKenney, (Wed Nov 19, 11:46 am)
Re: [PATCH 1/3] rcu: Introduce hlist_nulls variant of hlist, Arnaldo Carvalho de Melo, (Wed Nov 19, 11:53 am)
Re: [PATCH 0/3] net: RCU lookups for UDP, DCCP and TCP pro ..., Christoph Lameter, (Wed Nov 19, 12:52 pm)
Re: [PATCH 1/3] rcu: Introduce hlist_nulls variant of hlist, Paul E. McKenney, (Wed Nov 19, 2:17 pm)
Re: [PATCH 1/3] rcu: Introduce hlist_nulls variant of hlist, Paul E. McKenney, (Wed Nov 19, 2:21 pm)
Re: [PATCH] net: Convert TCP/DCCP listening hash tables to ..., Paul E. McKenney, (Sun Nov 23, 12:17 pm)