mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
Refactor netstack to use bufferv2 instead of buffer.
This change has significant performance implications. bufferv2 is reference counted and pooled, which alleviates heap/GC pressure. Below are the results from running the iperf benchmark. HEAD: BenchmarkIperf/operation.Upload-16 1552 ns/op 46.6GiB total allocations BenchmarkIperf/operation.Download-16 1114 ns/op 68.6GiB total allocations w/ change: BenchmarkIperf/operation.Upload-16 1139 ns/op (-27%) 1.41GiB total allocations (-97%) BenchmarkIperf/operation.Download-16 753.2 ns/op (-33%) 706MiB total allocations (-99%) PiperOrigin-RevId: 462453185
This commit is contained in:
committed by
gVisor bot
parent
da267f435f
commit
1f2b30d70c
@@ -3001,14 +3001,17 @@ func (s *socketOpsCommon) recvErr(t *kernel.Task, dst usermem.IOSequence) (int,
|
||||
if sockErr == nil {
|
||||
return 0, 0, nil, 0, socket.ControlMessages{}, syserr.ErrTryAgain
|
||||
}
|
||||
if sockErr.Payload != nil {
|
||||
defer sockErr.Payload.Release()
|
||||
}
|
||||
|
||||
// The payload of the original packet that caused the error is passed as
|
||||
// normal data via msg_iovec. -- recvmsg(2)
|
||||
msgFlags := linux.MSG_ERRQUEUE
|
||||
if int(dst.NumBytes()) < len(sockErr.Payload) {
|
||||
if int(dst.NumBytes()) < sockErr.Payload.Size() {
|
||||
msgFlags |= linux.MSG_TRUNC
|
||||
}
|
||||
n, err := dst.CopyOut(t, sockErr.Payload)
|
||||
n, err := dst.CopyOut(t, sockErr.Payload.AsSlice())
|
||||
|
||||
// The original destination address of the datagram that caused the error is
|
||||
// supplied via msg_name. -- recvmsg(2)
|
||||
|
||||
Reference in New Issue
Block a user