diff options
author | Bhasker Hariharan <bhaskerh@google.com> | 2019-01-29 01:37:54 -0800 |
---|---|---|
committer | Shentubot <shentubot@google.com> | 2019-01-29 01:39:01 -0800 |
commit | 24cb2c0a7256cdb515c2fc2cfc90d130e2a405ef (patch) | |
tree | 602c0214434145c9ee6518fbb6a2c422149e026a /runsc | |
parent | b44699c5299bb0fc1b16d25a9ac2250cf0a7446d (diff) |
Use recvmmsg() instead of readv() to read packets from NIC.
This should reduce the number of syscalls required to process packets
significantly and improve throughputs.
PiperOrigin-RevId: 231366886
Change-Id: I8b38077262bf9c53176bc4a94b530188d3d7c0ca
Diffstat (limited to 'runsc')
-rw-r--r-- | runsc/boot/filter/config.go | 14 | ||||
-rw-r--r-- | runsc/boot/network.go | 1 |
2 files changed, 9 insertions, 6 deletions
diff --git a/runsc/boot/filter/config.go b/runsc/boot/filter/config.go index 83c1fbcce..bde749861 100644 --- a/runsc/boot/filter/config.go +++ b/runsc/boot/filter/config.go @@ -211,23 +211,25 @@ var allowedSyscalls = seccomp.SyscallRules{ syscall.SYS_PREAD64: {}, syscall.SYS_PWRITE64: {}, syscall.SYS_READ: {}, - syscall.SYS_READV: []seccomp.Rule{ + syscall.SYS_RECVMSG: []seccomp.Rule{ { seccomp.AllowAny{}, seccomp.AllowAny{}, - seccomp.AllowValue(len(fdbased.BufConfig)), + seccomp.AllowValue(syscall.MSG_DONTWAIT | syscall.MSG_TRUNC), }, - }, - syscall.SYS_RECVMSG: []seccomp.Rule{ { seccomp.AllowAny{}, seccomp.AllowAny{}, - seccomp.AllowValue(syscall.MSG_DONTWAIT | syscall.MSG_TRUNC), + seccomp.AllowValue(syscall.MSG_DONTWAIT | syscall.MSG_TRUNC | syscall.MSG_PEEK), }, + }, + syscall.SYS_RECVMMSG: []seccomp.Rule{ { seccomp.AllowAny{}, seccomp.AllowAny{}, - seccomp.AllowValue(syscall.MSG_DONTWAIT | syscall.MSG_TRUNC | syscall.MSG_PEEK), + seccomp.AllowValue(fdbased.MaxMsgsPerRecv), + seccomp.AllowValue(syscall.MSG_DONTWAIT), + seccomp.AllowValue(0), }, }, syscall.SYS_RESTART_SYSCALL: {}, diff --git a/runsc/boot/network.go b/runsc/boot/network.go index 89f186139..83d56f93a 100644 --- a/runsc/boot/network.go +++ b/runsc/boot/network.go @@ -140,6 +140,7 @@ func (n *Network) CreateLinksAndRoutes(args *CreateLinksAndRoutesArgs, _ *struct EthernetHeader: true, HandleLocal: true, Address: mac, + UseRecvMMsg: true, }) log.Infof("Enabling interface %q with id %d on addresses %+v (%v)", link.Name, nicID, link.Addresses, mac) |