udp: Use hlist_nulls in UDP RCU code

This is a straightforward patch, using hlist_nulls infrastructure.

RCUification already done on UDP two weeks ago.

Using hlist_nulls permits us to avoid some memory barriers, both
at lookup time and delete time.

Patch is large because it adds new macros to include/net/sock.h.
These macros will be used by TCP & DCCP in next patch.

Signed-off-by: Eric Dumazet <dada1@cosmosbay.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Eric Dumazet
2008-11-16 19:39:21 -08:00
committed by David S. Miller
parent bbaffaca48
commit 88ab1932ea
5 changed files with 83 additions and 66 deletions

View File

@@ -383,22 +383,5 @@ static inline void hlist_add_after_rcu(struct hlist_node *prev,
({ tpos = hlist_entry(pos, typeof(*tpos), member); 1; }); \
pos = rcu_dereference(pos->next))
/**
* hlist_for_each_entry_rcu_safenext - iterate over rcu list of given type
* @tpos: the type * to use as a loop cursor.
* @pos: the &struct hlist_node to use as a loop cursor.
* @head: the head for your list.
* @member: the name of the hlist_node within the struct.
* @next: the &struct hlist_node to use as a next cursor
*
* Special version of hlist_for_each_entry_rcu that make sure
* each next pointer is fetched before each iteration.
*/
#define hlist_for_each_entry_rcu_safenext(tpos, pos, head, member, next) \
for (pos = rcu_dereference((head)->first); \
pos && ({ next = pos->next; smp_rmb(); prefetch(next); 1; }) && \
({ tpos = hlist_entry(pos, typeof(*tpos), member); 1; }); \
pos = rcu_dereference(next))
#endif /* __KERNEL__ */
#endif