1
0
Fork 0
alistair23-linux/net/dccp
Eric Dumazet 4381548237 net: sock_def_readable() and friends RCU conversion
sk_callback_lock rwlock actually protects sk->sk_sleep pointer, so we
need two atomic operations (and associated dirtying) per incoming
packet.

RCU conversion is pretty much needed :

1) Add a new structure, called "struct socket_wq" to hold all fields
that will need rcu_read_lock() protection (currently: a
wait_queue_head_t and a struct fasync_struct pointer).

[Future patch will add a list anchor for wakeup coalescing]

2) Attach one of such structure to each "struct socket" created in
sock_alloc_inode().

3) Respect RCU grace period when freeing a "struct socket_wq"

4) Change sk_sleep pointer in "struct sock" by sk_wq, pointer to "struct
socket_wq"

5) Change sk_sleep() function to use new sk->sk_wq instead of
sk->sk_sleep

6) Change sk_has_sleeper() to wq_has_sleeper() that must be used inside
a rcu_read_lock() section.

7) Change all sk_has_sleeper() callers to :
  - Use rcu_read_lock() instead of read_lock(&sk->sk_callback_lock)
  - Use wq_has_sleeper() to eventually wakeup tasks.
  - Use rcu_read_unlock() instead of read_unlock(&sk->sk_callback_lock)

8) sock_wake_async() is modified to use rcu protection as well.

9) Exceptions :
  macvtap, drivers/net/tun.c, af_unix use integrated "struct socket_wq"
instead of dynamically allocated ones. They dont need rcu freeing.

Some cleanups or followups are probably needed, (possible
sk_callback_lock conversion to a spinlock for example...).

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2010-05-01 15:00:15 -07:00
..
ccids Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6 2010-04-11 14:53:53 -07:00
Kconfig dccp: Lockless integration of CCID congestion-control plugins 2009-01-04 21:42:53 -08:00
Makefile dccp: Integrate the TFRC library with DCCP 2009-01-04 21:45:33 -08:00
ackvec.c dccp: Set per-connection CCIDs via socket options 2008-11-23 16:02:31 -08:00
ackvec.h dccp: Minimise header option overhead in setting the MPS 2009-03-02 03:07:23 -08:00
ccid.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
ccid.h dccp: fix bug in cache allocation 2010-02-03 19:00:30 -08:00
dccp.h inet: Remove unused send_check length argument 2010-04-11 15:29:09 -07:00
diag.c dccp_diag: LISTEN sockets don't have CCIDs 2008-12-17 16:08:01 -08:00
feat.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
feat.h dccp: Debugging functions for feature negotiation 2009-01-21 14:34:05 -08:00
input.c Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6 2010-04-11 14:53:53 -07:00
ipv4.c inet: Remove unused send_check length argument 2010-04-11 15:29:09 -07:00
ipv6.c net: replace ipfragok with skb->local_df 2010-04-15 23:36:37 -07:00
ipv6.h Remove obsolete #include <linux/config.h> 2006-06-30 19:25:36 +02:00
minisocks.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
options.c dccp: Debugging functions for feature negotiation 2009-01-21 14:34:05 -08:00
output.c net: sock_def_readable() and friends RCU conversion 2010-05-01 15:00:15 -07:00
probe.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
proto.c net: sk_sleep() helper 2010-04-20 16:37:13 -07:00
sysctl.c sysctl net: Remove unused binary sysctl code 2009-11-12 02:05:06 -08:00
timer.c net: sk_dst_cache RCUification 2010-04-13 01:41:33 -07:00