On 03/21/2019 03:17 PM, Eric Dumazet wrote:
> Often times, recvmsg() system calls and BH handling for a particular
> TCP socket are done on different cpus.

...

> Note that if rps/rfs is used, we do not enable this feature, because
> there is high chance that the same cpu is handling both the recvmsg()
> system call and the TCP rx path, but that another cpu did the skb
> allocations in the device driver right before the RPS/RFS logic.
> 
> To properly handle this case, it seems we would need to record
> on which cpu skb was allocated, and use a different channel
> to give skbs back to this cpu.

Oops a rebase went wrong and I missed the following bit,
this will be added in v2.

diff --git a/include/net/sock.h b/include/net/sock.h
index 
a7e936ce5a5ac935d90c47f6dd68bf9e8e47ba10..0840f4b27b91eddb205ff42c03f787e5914f755d
 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -2439,7 +2439,7 @@ static inline void skb_setup_tx_timestamp(struct sk_buff 
*skb, __u16 tsflags)
 static inline void sk_eat_skb(struct sock *sk, struct sk_buff *skb)
 {
        __skb_unlink(skb, &sk->sk_receive_queue);
-       if (!sk->sk_rx_skb_cache) {
+       if (!static_branch_unlikely(&rps_needed) && !sk->sk_rx_skb_cache) {
                sk->sk_rx_skb_cache = skb;
                skb_orphan(skb);
                return;

Reply via email to