Skip to content

Commit c3f1dba

Browse files
majnemerdavem330
authored andcommitted
net: Update RFS target at poll for tcp/udp
The current state of affairs is that read()/write() will setup RFS (Receive Flow Steering) for internet protocol sockets while poll()/epoll() does not. When poll() gets called with a TCP or UDP socket, we should update the flow target. This permits to RFS (if enabled) to select the appropriate CPU for following incoming packets. Note: Only connected UDP sockets can benefit from RFS. Signed-off-by: David Majnemer <[email protected]> Signed-off-by: Eric Dumazet <[email protected]> Cc: Paul Turner <[email protected]> Cc: Tom Herbert <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent aef6de5 commit c3f1dba

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

net/ipv4/tcp.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -436,6 +436,8 @@ unsigned int tcp_poll(struct file *file, struct socket *sock, poll_table *wait)
436436
struct sock *sk = sock->sk;
437437
const struct tcp_sock *tp = tcp_sk(sk);
438438

439+
sock_rps_record_flow(sk);
440+
439441
sock_poll_wait(file, sk_sleep(sk), wait);
440442
if (sk->sk_state == TCP_LISTEN)
441443
return inet_csk_listen_poll(sk);

net/ipv4/udp.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1967,6 +1967,8 @@ unsigned int udp_poll(struct file *file, struct socket *sock, poll_table *wait)
19671967
unsigned int mask = datagram_poll(file, sock, wait);
19681968
struct sock *sk = sock->sk;
19691969

1970+
sock_rps_record_flow(sk);
1971+
19701972
/* Check for false positives due to checksum errors */
19711973
if ((mask & POLLRDNORM) && !(file->f_flags & O_NONBLOCK) &&
19721974
!(sk->sk_shutdown & RCV_SHUTDOWN) && !first_packet_length(sk))

0 commit comments

Comments
 (0)