mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-07-06 06:21:31 +00:00
net: sk_dst_cache RCUification
With latest CONFIG_PROVE_RCU stuff, I felt more comfortable to make this work. sk->sk_dst_cache is currently protected by a rwlock (sk_dst_lock) This rwlock is readlocked for a very small amount of time, and dst entries are already freed after RCU grace period. This calls for RCU again :) This patch converts sk_dst_lock to a spinlock, and use RCU for readers. __sk_dst_get() is supposed to be called with rcu_read_lock() or if socket locked by user, so use appropriate rcu_dereference_check() condition (rcu_read_lock_held() || sock_owned_by_user(sk)) This patch avoids two atomic ops per tx packet on UDP connected sockets, for example, and permits sk_dst_lock to be much less dirtied. Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
7a161ea924
commit
b6c6712a42
11 changed files with 60 additions and 61 deletions
|
@ -38,7 +38,7 @@ static int dccp_write_timeout(struct sock *sk)
|
|||
|
||||
if (sk->sk_state == DCCP_REQUESTING || sk->sk_state == DCCP_PARTOPEN) {
|
||||
if (icsk->icsk_retransmits != 0)
|
||||
dst_negative_advice(&sk->sk_dst_cache, sk);
|
||||
dst_negative_advice(sk);
|
||||
retry_until = icsk->icsk_syn_retries ?
|
||||
: sysctl_dccp_request_retries;
|
||||
} else {
|
||||
|
@ -63,7 +63,7 @@ static int dccp_write_timeout(struct sock *sk)
|
|||
Golden words :-).
|
||||
*/
|
||||
|
||||
dst_negative_advice(&sk->sk_dst_cache, sk);
|
||||
dst_negative_advice(sk);
|
||||
}
|
||||
|
||||
retry_until = sysctl_dccp_retries2;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue