* CPU affinity behavior of liburcu call-rcu per-cpu worker threads
@ 2026-07-09 18:48 Mathieu Desnoyers via lttng-dev
2026-07-09 20:00 ` Mathieu Desnoyers via lttng-dev
0 siblings, 1 reply; 2+ messages in thread
From: Mathieu Desnoyers via lttng-dev @ 2026-07-09 18:48 UTC (permalink / raw)
To: paulmck; +Cc: lttng-dev, Olivier Dion
Hi Paul,
I have a question related to liburcu per-cpu call-rcu worker threads.
So far in the current liburcu releases no affinity is set when the
worker threads are started. We have to wait for
SET_AFFINITY_CHECK_PERIOD_MASK grace periods before the affinity is set
(it takes about 2.5s in my benchmarks).
This means that short-lived test programs will get poor CPU affinity
for call-rcu worker threads at the beginning of their lifetime. So for
short lived programs, this means poor performance.
OTOH, if we have short-lived applications on a large machine, setting
the affinity immediately when the worker thread is starting means
we use CPU time on CPUs which may never be actually used by the
application (no call-rcu activity), which can be detrimental to other
use-cases as well.
So I was wondering: is the choice of skipping setting the affinity
on call-rcu worker thread startup done on purpose ? And if so,
should we perhaps consider setting the affinity as soon as the
worker thread is woken up for the first time rather than after
SET_AFFINITY_CHECK_PERIOD_MASK grace periods ?
Note that there is a commit in liburcu changing this behavior right
now, but it's not part of any release yet. I want to figure out the
wanted behavior before releasing this change:
commit 28f282af1905a1cf50ff9b5835b4cd9de4416ddf
Author: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Date: Wed Jul 1 12:49:43 2026 -0400
call_rcu: pin per-CPU worker at thread startup
Thanks,
Mathieu
--
Mathieu Desnoyers
EfficiOS Inc.
https://www.efficios.com
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: CPU affinity behavior of liburcu call-rcu per-cpu worker threads
2026-07-09 18:48 CPU affinity behavior of liburcu call-rcu per-cpu worker threads Mathieu Desnoyers via lttng-dev
@ 2026-07-09 20:00 ` Mathieu Desnoyers via lttng-dev
0 siblings, 0 replies; 2+ messages in thread
From: Mathieu Desnoyers via lttng-dev @ 2026-07-09 20:00 UTC (permalink / raw)
To: paulmck; +Cc: lttng-dev, Olivier Dion
On 2026-07-09 14:48, Mathieu Desnoyers wrote:
> Hi Paul,
>
> I have a question related to liburcu per-cpu call-rcu worker threads.
>
> So far in the current liburcu releases no affinity is set when the
> worker threads are started. We have to wait for
> SET_AFFINITY_CHECK_PERIOD_MASK grace periods before the affinity is set
> (it takes about 2.5s in my benchmarks).
>
> This means that short-lived test programs will get poor CPU affinity
> for call-rcu worker threads at the beginning of their lifetime. So for
> short lived programs, this means poor performance.
>
> OTOH, if we have short-lived applications on a large machine, setting
> the affinity immediately when the worker thread is starting means
> we use CPU time on CPUs which may never be actually used by the
> application (no call-rcu activity), which can be detrimental to other
> use-cases as well.
>
> So I was wondering: is the choice of skipping setting the affinity
> on call-rcu worker thread startup done on purpose ? And if so,
> should we perhaps consider setting the affinity as soon as the
> worker thread is woken up for the first time rather than after
> SET_AFFINITY_CHECK_PERIOD_MASK grace periods ?
I've implemented this compromise approach here:
https://review.lttng.org/c/userspace-rcu/+/18257 call-rcu worker: set CPU affinity on first non-empty dequeue
Feedback is welcome,
Thanks!
Mathieu
>
> Note that there is a commit in liburcu changing this behavior right
> now, but it's not part of any release yet. I want to figure out the
> wanted behavior before releasing this change:
>
> commit 28f282af1905a1cf50ff9b5835b4cd9de4416ddf
> Author: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
> Date: Wed Jul 1 12:49:43 2026 -0400
>
> call_rcu: pin per-CPU worker at thread startup
>
> Thanks,
>
> Mathieu
>
--
Mathieu Desnoyers
EfficiOS Inc.
https://www.efficios.com
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-07-09 20:00 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-07-09 18:48 CPU affinity behavior of liburcu call-rcu per-cpu worker threads Mathieu Desnoyers via lttng-dev
2026-07-09 20:00 ` Mathieu Desnoyers via lttng-dev
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox