Skip to content

Commit 21fd08b

Browse files
authored
ext/sockets: adding SO_BUSY_POLL socket option for Linux. (#17954)
To possibly reduce the latency when polling packets by activating it from the network interface for N microseconds. The kernel by doing so, increase the CPU(s) activity bound to the socket significantly. Note that not only the kernel needs to have support enabled for it (which the average distribution usually does) but the network interface itself needs to support it too. If not, it is just a no-op.
1 parent cd04535 commit 21fd08b

File tree

4 files changed

+13
-1
lines changed

4 files changed

+13
-1
lines changed

NEWS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@ PHP NEWS
150150
. socket_getsockname/socket_create/socket_bind handled AF_PACKET family socket.
151151
(David Carlier)
152152
. Added IP_BINDANY for a socket to bind to any address. (David Carlier)
153+
. Added SO_BUSY_POOL to reduce packets poll latency. (David Carlier)
153154

154155
- Sodium:
155156
. Fix overall theorical overflows on zend_string buffer allocations.

UPGRADING

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,7 @@ PHP 8.5 UPGRADE NOTES
308308
. TCP_BBR_ALGORITHM (FreeBSD only).
309309
. AF_PACKET (Linux only).
310310
. IP_BINDANY (FreeBSD/NetBSD/OpenBSD only).
311+
. SO_BUSY_POLL (Linux only).
311312

312313
========================================
313314
11. Changes to INI File Handling

ext/sockets/sockets.stub.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -454,6 +454,13 @@
454454
*/
455455
const SO_EXCLBIND = UNKNOWN;
456456
#endif
457+
#ifdef SO_BUSY_POLL
458+
/**
459+
* @var int
460+
* @cvalue SO_BUSY_POLL
461+
*/
462+
const SO_BUSY_POLL = UNKNOWN;
463+
#endif
457464
#ifdef SKF_AD_OFF
458465
/**
459466
* @var int

ext/sockets/sockets_arginfo.h

Lines changed: 4 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)