Skip to content

Commit 3ae0edc

Browse files
committed
ext/sockets: adding SO_BUSY_POLL socket option for Linux.
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 3677871 commit 3ae0edc

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
@@ -145,6 +145,7 @@ PHP NEWS
145145
. socket_getsockname/socket_create/socket_bind handled AF_PACKET family socket.
146146
(David Carlier)
147147
. Added IP_BINDANY for a socket to bind to any address. (David Carlier)
148+
. Added SO_BUSY_POOL to reduce packets poll latency. (David Carlier)
148149

149150
- Sodium:
150151
. Fix overall theorical overflows on zend_string buffer allocations.

UPGRADING

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,7 @@ PHP 8.5 UPGRADE NOTES
301301
. TCP_BBR_ALGORITHM (FreeBSD only).
302302
. AF_PACKET (Linux only).
303303
. IP_BINDANY (FreeBSD/NetBSD/OpenBSD only).
304+
. SO_BUSY_POLL (Linux only).
304305

305306
========================================
306307
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)