netstack: use unix.Syscall instead of BlockingPoll

unix.Syscall increases throughput and decreases CPU usage.

```
                                                  │ /tmp/old.log │            /tmp/new.log            │
                                                  │     Mb/s     │    Mb/s      vs base               │
TCPClient/role=server/host-gso=true/host-gro=true    13.61k ± 2%   13.93k ± 1%  +2.35% (p=0.000 n=10)
TCPClient/role=client/host-gso=true/host-gro=true    2.300k ± 1%   2.369k ± 1%  +3.00% (p=0.000 n=10)
geomean                                              5.595k        5.745k       +2.67%

                                                  │ /tmp/old.log │           /tmp/new.log            │
                                                  │   cpu-time   │  cpu-time   vs base               │
TCPClient/role=server/host-gso=true/host-gro=true     2.410 ± 0%   2.299 ± 1%  -4.62% (p=0.000 n=10)
TCPClient/role=client/host-gso=true/host-gro=true     2.883 ± 0%   2.802 ± 1%  -2.81% (p=0.000 n=10)
geomean                                               2.636        2.538       -3.72%
```

PiperOrigin-RevId: 540128696
This commit is contained in:
Kevin Krakauer
2023-06-13 18:07:51 -07:00
committed by gVisor bot
parent e5f2478bee
commit 30f3409d4f
+1 -1
View File
@@ -245,7 +245,7 @@ func BlockingPollUntilStopped(efd int, fd int, events int16) (bool, unix.Errno)
Events: events,
},
}
_, errno := BlockingPoll(&pevents[0], len(pevents), nil)
_, _, errno := unix.Syscall6(unix.SYS_PPOLL, uintptr(unsafe.Pointer(&pevents[0])), uintptr(len(pevents)), 0, 0, 0, 0)
if errno != 0 {
return pevents[0].Revents&unix.POLLIN != 0, errno
}