Skip to content

Commit 2c8c56e

Browse files
edumazetdavem330
authored andcommitted
net: introduce SO_INCOMING_CPU
Alternative to RPS/RFS is to use hardware support for multiple queues. Then split a set of million of sockets into worker threads, each one using epoll() to manage events on its own socket pool. Ideally, we want one thread per RX/TX queue/cpu, but we have no way to know after accept() or connect() on which queue/cpu a socket is managed. We normally use one cpu per RX queue (IRQ smp_affinity being properly set), so remembering on socket structure which cpu delivered last packet is enough to solve the problem. After accept(), connect(), or even file descriptor passing around processes, applications can use : int cpu; socklen_t len = sizeof(cpu); getsockopt(fd, SOL_SOCKET, SO_INCOMING_CPU, &cpu, &len); And use this information to put the socket into the right silo for optimal performance, as all networking stack should run on the appropriate cpu, without need to send IPI (RPS/RFS). Signed-off-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 3d97379 commit 2c8c56e

21 files changed

Lines changed: 52 additions & 2 deletions

File tree

‎arch/alpha/include/uapi/asm/socket.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,4 +87,6 @@
8787

8888
#define SO_BPF_EXTENSIONS 48
8989

90+
#define SO_INCOMING_CPU 49
91+
9092
#endif /* _UAPI_ASM_SOCKET_H */

‎arch/avr32/include/uapi/asm/socket.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,4 +80,6 @@
8080

8181
#define SO_BPF_EXTENSIONS 48
8282

83+
#define SO_INCOMING_CPU 49
84+
8385
#endif /* _UAPI__ASM_AVR32_SOCKET_H */

‎arch/cris/include/uapi/asm/socket.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,8 @@
8282

8383
#define SO_BPF_EXTENSIONS 48
8484

85+
#define SO_INCOMING_CPU 49
86+
8587
#endif /* _ASM_SOCKET_H */
8688

8789

‎arch/frv/include/uapi/asm/socket.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,5 +80,7 @@
8080

8181
#define SO_BPF_EXTENSIONS 48
8282

83+
#define SO_INCOMING_CPU 49
84+
8385
#endif /* _ASM_SOCKET_H */
8486

‎arch/ia64/include/uapi/asm/socket.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,4 +89,6 @@
8989

9090
#define SO_BPF_EXTENSIONS 48
9191

92+
#define SO_INCOMING_CPU 49
93+
9294
#endif /* _ASM_IA64_SOCKET_H */

‎arch/m32r/include/uapi/asm/socket.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,4 +80,6 @@
8080

8181
#define SO_BPF_EXTENSIONS 48
8282

83+
#define SO_INCOMING_CPU 49
84+
8385
#endif /* _ASM_M32R_SOCKET_H */

‎arch/mips/include/uapi/asm/socket.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,4 +98,6 @@
9898

9999
#define SO_BPF_EXTENSIONS 48
100100

101+
#define SO_INCOMING_CPU 49
102+
101103
#endif /* _UAPI_ASM_SOCKET_H */

‎arch/mn10300/include/uapi/asm/socket.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,4 +80,6 @@
8080

8181
#define SO_BPF_EXTENSIONS 48
8282

83+
#define SO_INCOMING_CPU 49
84+
8385
#endif /* _ASM_SOCKET_H */

‎arch/parisc/include/uapi/asm/socket.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,4 +79,6 @@
7979

8080
#define SO_BPF_EXTENSIONS 0x4029
8181

82+
#define SO_INCOMING_CPU 0x402A
83+
8284
#endif /* _UAPI_ASM_SOCKET_H */

‎arch/powerpc/include/uapi/asm/socket.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,4 +87,6 @@
8787

8888
#define SO_BPF_EXTENSIONS 48
8989

90+
#define SO_INCOMING_CPU 49
91+
9092
#endif /* _ASM_POWERPC_SOCKET_H */

0 commit comments

Comments
 (0)