Re: [RFC PATCH] net/core: use wake_up_interruptible_poll() in sock_def_readable()
From: Jiayuan Chen
Date: Tue May 26 2026 - 05:15:23 EST
On 5/26/26 2:36 PM, Xuewen Yan wrote:
sock_def_readable() currently uses wake_up_interruptible_sync_poll() to
wake up tasks waiting for readable data on a socket. The _sync variant
sets the WF_SYNC flag, which tells the scheduler that the waker will
schedule away soon, so the wakee should stay on the same CPU to avoid
needless cache bouncing.
However, we found that the following stack:
-vfs_write
-sock_write_iter
-unix_stream_sendmsg
-sock_def_readable
-__wake_up_sync_key
In this process-context scenario, the waker does NOT go to sleep
after the wakeup. With WF_SYNC, the scheduler is misled into placing
the wakee on the waker's CPU (via wake_affine_idle()'s sync path when
nr_running == 1), causing both the sender and receiver to contend for
the same CPU. This may hurt throughput for IPC workloads on multi-core
systems where the sender and receiver could otherwise run in parallel
on different CPUs.
WF_SYNC isn't a hard binding.
What's your test environment and benchmark ?