Re: [RFC PATCH] net/core: use wake_up_interruptible_poll() in sock_def_readable()
From: Xuewen Yan
Date: Tue May 26 2026 - 07:07:08 EST
On Tue, May 26, 2026 at 5:08 PM Jiayuan Chen <jiayuan.chen@xxxxxxxxx> wrote:
>
>
> 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 ?
We tested the app installation speed on Android 17 with kernel 6.18.
After removing sync, we observed a significant improvement in
installation speed.
Thanks!