Skip to content

Commit a2e2725

Browse files
acmeldavem330
authored andcommitted
net: Introduce recvmmsg socket syscall
Meaning receive multiple messages, reducing the number of syscalls and net stack entry/exit operations. Next patches will introduce mechanisms where protocols that want to optimize this operation will provide an unlocked_recvmsg operation. This takes into account comments made by: . Paul Moore: sock_recvmsg is called only for the first datagram, sock_recvmsg_nosec is used for the rest. . Caitlin Bestler: recvmmsg now has a struct timespec timeout, that works in the same fashion as the ppoll one. If the underlying protocol returns a datagram with MSG_OOB set, this will make recvmmsg return right away with as many datagrams (+ the OOB one) it has received so far. . Rémi Denis-Courmont & Steven Whitehouse: If we receive N < vlen datagrams and then recvmsg returns an error, recvmmsg will return the successfully received datagrams, store the error and return it in the next call. This paves the way for a subsequent optimization, sk_prot->unlocked_recvmsg, where we will be able to acquire the lock only at batch start and end, not at every underlying recvmsg call. Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent c05e85a commit a2e2725

25 files changed

Lines changed: 261 additions & 50 deletions

File tree

‎arch/alpha/kernel/systbls.S‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -497,6 +497,7 @@ sys_call_table:
497497
.quad sys_signalfd
498498
.quad sys_ni_syscall
499499
.quad sys_eventfd
500+
.quad sys_recvmmsg
500501

501502
.size sys_call_table, . - sys_call_table
502503
.type sys_call_table, @object

‎arch/arm/kernel/calls.S‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -374,6 +374,7 @@
374374
CALL(sys_pwritev)
375375
CALL(sys_rt_tgsigqueueinfo)
376376
CALL(sys_perf_event_open)
377+
/* 365 */ CALL(sys_recvmmsg)
377378
#ifndef syscalls_counted
378379
.equ syscalls_padding, ((NR_syscalls + 3) & ~3) - NR_syscalls
379380
#define syscalls_counted

‎arch/avr32/kernel/syscall_table.S‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,4 +295,5 @@ sys_call_table:
295295
.long sys_signalfd
296296
.long sys_ni_syscall /* 280, was sys_timerfd */
297297
.long sys_eventfd
298+
.long sys_recvmmsg
298299
.long sys_ni_syscall /* r8 is saturated at nr_syscalls */

‎arch/blackfin/mach-common/entry.S‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1621,6 +1621,7 @@ ENTRY(_sys_call_table)
16211621
.long _sys_pwritev
16221622
.long _sys_rt_tgsigqueueinfo
16231623
.long _sys_perf_event_open
1624+
.long _sys_recvmmsg /* 370 */
16241625

16251626
.rept NR_syscalls-(.-_sys_call_table)/4
16261627
.long _sys_ni_syscall

‎arch/ia64/kernel/entry.S‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1806,6 +1806,7 @@ sys_call_table:
18061806
data8 sys_preadv
18071807
data8 sys_pwritev // 1320
18081808
data8 sys_rt_tgsigqueueinfo
1809+
data8 sys_recvmmsg
18091810

18101811
.org sys_call_table + 8*NR_syscalls // guard against failures to increase NR_syscalls
18111812
#endif /* __IA64_ASM_PARAVIRTUALIZED_NATIVE */

‎arch/microblaze/kernel/syscall_table.S‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -371,3 +371,4 @@ ENTRY(sys_call_table)
371371
.long sys_ni_syscall
372372
.long sys_rt_tgsigqueueinfo /* 365 */
373373
.long sys_perf_event_open
374+
.long sys_recvmmsg

‎arch/mips/kernel/scall32-o32.S‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -583,6 +583,7 @@ einval: li v0, -ENOSYS
583583
sys sys_rt_tgsigqueueinfo 4
584584
sys sys_perf_event_open 5
585585
sys sys_accept4 4
586+
sys sys_recvmmsg 5
586587
.endm
587588

588589
/* We pre-compute the number of _instruction_ bytes needed to

‎arch/mips/kernel/scall64-64.S‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -420,4 +420,5 @@ sys_call_table:
420420
PTR sys_rt_tgsigqueueinfo
421421
PTR sys_perf_event_open
422422
PTR sys_accept4
423+
PTR sys_recvmmsg
423424
.size sys_call_table,.-sys_call_table

‎arch/mips/kernel/scall64-n32.S‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -418,4 +418,5 @@ EXPORT(sysn32_call_table)
418418
PTR compat_sys_rt_tgsigqueueinfo /* 5295 */
419419
PTR sys_perf_event_open
420420
PTR sys_accept4
421+
PTR compat_sys_recvmmsg
421422
.size sysn32_call_table,.-sysn32_call_table

‎arch/mips/kernel/scall64-o32.S‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -538,4 +538,5 @@ sys_call_table:
538538
PTR compat_sys_rt_tgsigqueueinfo
539539
PTR sys_perf_event_open
540540
PTR sys_accept4
541+
PTR compat_sys_recvmmsg
541542
.size sys_call_table,.-sys_call_table

0 commit comments

Comments
 (0)