Linux Documentation
 help / color / mirror / Atom feed
From: "Ahmed S. Darwish" <darwi@linutronix.de>
To: Zixin Wang <w1355457260@gmail.com>
Cc: linux-doc@vger.kernel.org, linux-rt-devel@lists.linux.dev,
	bigeasy@linutronix.de, frederic@kernel.org,
	john.ogness@linutronix.de, clrkwllms@kernel.org,
	rostedt@goodmis.org, corbet@lwn.net, wagi@monom.org,
	atomlin@atomlin.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v5] Documentation: real-time: Add boot parameters and task isolation section
Date: Tue, 24 Nov 2026 18:48:37 +0100	[thread overview]
Message-ID: <awXN9RY3x5xEGFe4@lx-t490> (raw)
In-Reply-To: <20261124163202.56921-1-w1355457260@gmail.com>

Hi Zixin,

On Tue, 24 Nov 2026, Zixin Wang wrote:
> +
> +``rcu_nocbs[=cpu-list]``
> +  Offload RCU callback invocation from the listed CPUs to the
> +  corresponding ``rcuo`` kthread, which can run on a housekeeping CPU.
> +  This reduces callback-processing jitter on the CPU that enqueued them.
> +  On a non-real-time kernel this also moves invocation out of softirq
> +  context; with PREEMPT_RT, callbacks already run in kthread context
> +  because ``rcutree.use_softirq`` is false, and the offload only changes
> +  where they run.  If the parameter is given without a CPU list, no CPU
> +  is offloaded at boot; the mode can still be toggled at runtime through
> +  cpusets.  The parameter takes precedence over
> +  ``CONFIG_RCU_NOCB_CPU_DEFAULT_ALL``.
> +
> +``rcu_nocb_poll``
> +  Make the ``rcuo`` kthreads poll for callbacks instead of requiring the
> +  offloaded CPUs to wake them.  This improves the real-time response at
> +  the cost of higher power consumption, because the kthreads wake up
> +  periodically to do the polling.  Consider this option only when wakeup
> +  latency matters more than power.
> +
...
> +.. _real_time_boot_parameters:
> +
> +Boot parameters and task isolation
> +==================================
> +
> +Kernel configuration options alone do not determine a real-time system's
> +worst-case latency.  Integrators commonly rely on boot parameters and
> +runtime tunables as well, to keep kernel housekeeping work away from
> +latency-sensitive tasks.  The parameters below complement the options
> +described above.  Some of them correspond to a configuration option and
> +are referenced from that option's section, so the configuration and
> +runtime guidance stay together.  Each one is documented in detail in
> +Documentation/admin-guide/kernel-parameters.rst; the notes here focus on
> +the aspects that matter for real-time latency.  Consider these options
> +only when the workload suffers from the corresponding interference;
> +leave them disabled otherwise, as each of them trades flexibility or
> +power for a lower worst-case latency.  The notes below follow the
> +decisions an integrator has to make: whether to keep tasks off a CPU,
> +whether to stop its tick, and where interrupts should run.  Idle state
> +limits are discussed with ``CONFIG_CPU_IDLE`` above, and RCU callback
> +offloading with ``CONFIG_RCU_NOCB_CPU`` above.
> +For the full CPU isolation model and its limitations, see
> +Documentation/admin-guide/cpu-isolation.rst.
> +
> +.. caution::
> +
> +  CPU isolation is best effort.  Work that is explicitly bound to an
> +  isolated CPU, such as per-CPU kernel threads, bound workqueues, and
> +  interrupts, may still run there unless it is steered away.  Measure
> +  the resulting latency with tools such as ``osnoise``, ``timerlat``,
> +  and ``rtla`` rather than assuming that an isolated CPU is free of
> +  kernel noise.  See Documentation/timers/no_hz.rst and
> +  Documentation/tools/rtla/index.rst.
> +
> +CPU isolation
> +-------------
> +
> +``isolcpus=``
> +  Format: ``[flag-list,]<cpu-list>``.  Isolates the listed CPUs from the
> +  disturbances selected by the flag list (default: ``domain``):
> +
> +  ``domain``
> +    Remove the CPUs from the scheduler domains.  This is the default
> +    when no flag is given.  Domain isolation cannot be undone at
> +    runtime; use cpusets when the isolated CPU set must change
> +    dynamically.  Isolated CPUs remain usable through CPU affinity or
> +    cpusets.  Unbound workqueues and unbound kernel threads are
> +    confined to the housekeeping CPUs as a side effect.  Consider it
> +    for CPUs dedicated to a latency-sensitive workload.
> +
> +  ``nohz``
> +    Equivalent to ``nohz_full=``; see below.  The residual 1 Hz tick is
> +    offloaded to workqueues, which must be affine to the housekeeping
> +    CPUs through the global workqueue ``cpumask``
> +    (/sys/devices/virtual/workqueue/cpumask).  By default the global
> +    workqueue runs on all CPUs; configure this cpumask manually after
> +    boot, or use the ``domain`` flag to confine unbound workqueues.
> +
> +  A practical configuration therefore combines ``isolcpus=`` with
> +  ``nohz_full=``, ``rcu_nocbs=``, an interrupt affinity mask, and, on
> +  x86 systems, a C-state limit.
> +
> +  Timer placement follows the same choice.  By default a migratable
> +  timer expires on the CPU that armed it; with ``nohz`` (or
> +  ``nohz_full=``), timers and hrtimers armed on the isolated CPUs are
> +  migrated to housekeeping CPUs.
> +
> +``nohz_full=``
> +  Format: ``<cpu-list>``.  Requires ``CONFIG_NO_HZ_FULL=y``.  Stops the
> +  scheduler tick on the listed CPUs whenever possible.  The boot CPU is
> +  forced outside the range to maintain timekeeping, and the RCU
> +  callbacks of the listed CPUs are offloaded as if they had been
> +  passed to ``rcu_nocbs=``; see the ``CONFIG_RCU_NOCB_CPU`` section
> +  above.  This parameter takes precedence over
> +  ``CONFIG_RCU_NOCB_CPU_DEFAULT_ALL``.
> +
> +  The trade-off between tickless operation and the kernel-to-userspace
> +  transition latency is described in the ``CONFIG_NO_HZ`` /
> +  ``CONFIG_NO_HZ_FULL`` section above.
> +
> +Interrupt affinity
> +------------------
> +
> +``irqaffinity=``
> +  Format: ``<cpu-list>``.  Sets the default affinity mask for
> +  interrupts that do not have an explicit affinity, steering them to
> +  the housekeeping CPUs.  Managed interrupts are not affected by this
> +  setting and cannot be redirected through ``/proc/irq/*``.  Verify
> +  the resulting placement in ``/proc/interrupts``.  See
> +  Documentation/core-api/irq/managed_irq.rst.
> +
>

Thanks for the write-up above.

I wrote the RT configuration guide some time ago, where "configuration"
here implied kconfig build-time .config generation.

It is true, of course, that "kernel configuration options alone do not
determine a real-time system's worst-case latency".  But this does not mean
that all the RT optimization tricks above must be squeezed together into
the kernel RT /configuration/ guide.

There's also a kernel configuration checker that produces lots of links to
this guide:

    https://msgid.link/20261106091922.7560-1-darwi@linutronix.de

So I don't think that expanding the scope of this document into overall RT
optimizations tricks will help.

Since the whole of Documentation/real-time/ is dedicated to PREEMPT_RT, why
not integrate these RT-optimization information into a proper guide there?

Then, let this configuration guide link to the relevant sections only when
necessary.  This way, scope creep is avoided.

Thanks!

--
Ahmed S. Darwish
Linutronix GmbH

      reply	other threads:[~2026-11-24 17:48 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-24 16:32 [PATCH v5] Documentation: real-time: Add boot parameters and task isolation section Zixin Wang
2026-11-24 17:48 ` Ahmed S. Darwish [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=awXN9RY3x5xEGFe4@lx-t490 \
    --to=darwi@linutronix.de \
    --cc=atomlin@atomlin.com \
    --cc=bigeasy@linutronix.de \
    --cc=clrkwllms@kernel.org \
    --cc=corbet@lwn.net \
    --cc=frederic@kernel.org \
    --cc=john.ogness@linutronix.de \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rt-devel@lists.linux.dev \
    --cc=rostedt@goodmis.org \
    --cc=w1355457260@gmail.com \
    --cc=wagi@monom.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox