mirror of
https://github.com/torvalds/linux.git
synced 2025-11-03 01:59:51 +02:00
1) Per-CPU kthreads must stay affine to a single CPU and never execute
relevant code on any other CPU. This is currently handled by smpboot
code which takes care of CPU-hotplug operations. Affinity here is
a correctness constraint.
2) Some kthreads _have_ to be affine to a specific set of CPUs and can't
run anywhere else. The affinity is set through kthread_bind_mask()
and the subsystem takes care by itself to handle CPU-hotplug
operations. Affinity here is assumed to be a correctness constraint.
3) Per-node kthreads _prefer_ to be affine to a specific NUMA node. This
is not a correctness constraint but merely a preference in terms of
memory locality. kswapd and kcompactd both fall into this category.
The affinity is set manually like for any other task and CPU-hotplug
is supposed to be handled by the relevant subsystem so that the task
is properly reaffined whenever a given CPU from the node comes up.
Also care should be taken so that the node affinity doesn't cross
isolated (nohz_full) cpumask boundaries.
4) Similar to the previous point except kthreads have a _preferred_
affinity different than a node. Both RCU boost kthreads and RCU
exp kworkers fall into this category as they refer to "RCU nodes"
from a distinctly distributed tree.
Currently the preferred affinity patterns (3 and 4) have at least 4
identified users, with more or less success when it comes to handle
CPU-hotplug operations and CPU isolation. Each of which do it in its own
ad-hoc way.
This is an infrastructure proposal to handle this with the following API
changes:
_ kthread_create_on_node() automatically affines the created kthread to
its target node unless it has been set as per-cpu or bound with
kthread_bind[_mask]() before the first wake-up.
- kthread_affine_preferred() is a new function that can be called right
after kthread_create_on_node() to specify a preferred affinity
different than the specified node.
When the preferred affinity can't be applied because the possible
targets are offline or isolated (nohz_full), the kthread is affine
to the housekeeping CPUs (which means to all online CPUs most of the
time or only the non-nohz_full CPUs when nohz_full= is set).
kswapd, kcompactd, RCU boost kthreads and RCU exp kworkers have been
converted, along with a few old drivers.
Summary of the changes:
* Consolidate a bunch of ad-hoc implementations of kthread_run_on_cpu()
* Introduce task_cpu_fallback_mask() that defines the default last
resort affinity of a task to become nohz_full aware
* Add some correctness check to ensure kthread_bind() is always called
before the first kthread wake up.
* Default affine kthread to its preferred node.
* Convert kswapd / kcompactd and remove their halfway working ad-hoc
affinity implementation
* Implement kthreads preferred affinity
* Unify kthread worker and kthread API's style
* Convert RCU kthreads to the new API and remove the ad-hoc affinity
implementation.
-----BEGIN PGP SIGNATURE-----
iQIzBAABCAAdFiEEd76+gtGM8MbftQlOhSRUR1COjHcFAmeNf8gACgkQhSRUR1CO
jHedQQ/+IxTjjqQiItzrq41TES2S0desHDq8lNJFb7rsR/DtKFyLx3s67cOYV+cM
Yx54QHg2m/Fz4nXMQ7Po5ygOtJGCKBc5C5QQy7y0lVKeTQK+daDfEtBSa3oG7j3C
u+E3tTY6qxkbCzymUyaKkHN4/ay2vLvjFS50luV7KMyI3x47Aji+t7VdCX4LCPP2
eAwOALWD0+7qLJ/VF6gsmQLKA4Qx7PQAzBa3KSBmUN9UcN8Gk1bQHCTIQKDHP9LQ
v8BXrNZtYX1o2+snNYpX2z6/ECjxkdwriOgqqZY5306hd9RAQ1u46Dx3byrIqjGn
ULG/XQ2istPyhTqb/h+RbrobdOcwEUIeqk8hRRbBXE8bPpqUz9EMuaCMxWDbQjgH
NTuKG4ifKJ/IqstkkuDkdOiByE/ysMmwqrTXgSnu2ITNL9yY3BEgFbvA95hgo42s
f7QCxEfZb1MHcNEMENSMwM3xw5lLMGMpxVZcMQ3gLwyotMBRrhFZm1qZJG7TITYW
IDIeCbH4JOMdQwLs3CcWTXio0N5/85NhRNFV+IDn96OrgxObgnMtV8QwNgjXBAJ5
wGeJWt8s34W1Zo3qS9gEuVzEhW4XaxISQQMkHe8faKkK6iHmIB/VjSQikDwwUNQ/
AspYj82RyWBCDZsqhiYh71kpxjvS6Xp0bj39Ce1sNsOnuksxKkQ=
=g8In
-----END PGP SIGNATURE-----
Merge tag 'kthread-for-6.14-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/frederic/linux-dynticks
Pull kthread updates from Frederic Weisbecker:
"Kthreads affinity follow either of 4 existing different patterns:
1) Per-CPU kthreads must stay affine to a single CPU and never
execute relevant code on any other CPU. This is currently handled
by smpboot code which takes care of CPU-hotplug operations.
Affinity here is a correctness constraint.
2) Some kthreads _have_ to be affine to a specific set of CPUs and
can't run anywhere else. The affinity is set through
kthread_bind_mask() and the subsystem takes care by itself to
handle CPU-hotplug operations. Affinity here is assumed to be a
correctness constraint.
3) Per-node kthreads _prefer_ to be affine to a specific NUMA node.
This is not a correctness constraint but merely a preference in
terms of memory locality. kswapd and kcompactd both fall into this
category. The affinity is set manually like for any other task and
CPU-hotplug is supposed to be handled by the relevant subsystem so
that the task is properly reaffined whenever a given CPU from the
node comes up. Also care should be taken so that the node affinity
doesn't cross isolated (nohz_full) cpumask boundaries.
4) Similar to the previous point except kthreads have a _preferred_
affinity different than a node. Both RCU boost kthreads and RCU
exp kworkers fall into this category as they refer to "RCU nodes"
from a distinctly distributed tree.
Currently the preferred affinity patterns (3 and 4) have at least 4
identified users, with more or less success when it comes to handle
CPU-hotplug operations and CPU isolation. Each of which do it in its
own ad-hoc way.
This is an infrastructure proposal to handle this with the following
API changes:
- kthread_create_on_node() automatically affines the created kthread
to its target node unless it has been set as per-cpu or bound with
kthread_bind[_mask]() before the first wake-up.
- kthread_affine_preferred() is a new function that can be called
right after kthread_create_on_node() to specify a preferred
affinity different than the specified node.
When the preferred affinity can't be applied because the possible
targets are offline or isolated (nohz_full), the kthread is affine to
the housekeeping CPUs (which means to all online CPUs most of the time
or only the non-nohz_full CPUs when nohz_full= is set).
kswapd, kcompactd, RCU boost kthreads and RCU exp kworkers have been
converted, along with a few old drivers.
Summary of the changes:
- Consolidate a bunch of ad-hoc implementations of
kthread_run_on_cpu()
- Introduce task_cpu_fallback_mask() that defines the default last
resort affinity of a task to become nohz_full aware
- Add some correctness check to ensure kthread_bind() is always
called before the first kthread wake up.
- Default affine kthread to its preferred node.
- Convert kswapd / kcompactd and remove their halfway working ad-hoc
affinity implementation
- Implement kthreads preferred affinity
- Unify kthread worker and kthread API's style
- Convert RCU kthreads to the new API and remove the ad-hoc affinity
implementation"
* tag 'kthread-for-6.14-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/frederic/linux-dynticks:
kthread: modify kernel-doc function name to match code
rcu: Use kthread preferred affinity for RCU exp kworkers
treewide: Introduce kthread_run_worker[_on_cpu]()
kthread: Unify kthread_create_on_cpu() and kthread_create_worker_on_cpu() automatic format
rcu: Use kthread preferred affinity for RCU boost
kthread: Implement preferred affinity
mm: Create/affine kswapd to its preferred node
mm: Create/affine kcompactd to its preferred node
kthread: Default affine kthread to its preferred NUMA node
kthread: Make sure kthread hasn't started while binding it
sched,arm64: Handle CPU isolation on last resort fallback rq selection
arm64: Exclude nohz_full CPUs from 32bits el0 support
lib: test_objpool: Use kthread_run_on_cpu()
kallsyms: Use kthread_run_on_cpu()
soc/qman: test: Use kthread_run_on_cpu()
arm/bL_switcher: Use kthread_run_on_cpu()
|
||
|---|---|---|
| .. | ||
| selftests | ||
| shaders | ||
| uc | ||
| gen2_engine_cs.c | ||
| gen2_engine_cs.h | ||
| gen6_engine_cs.c | ||
| gen6_engine_cs.h | ||
| gen6_ppgtt.c | ||
| gen6_ppgtt.h | ||
| gen6_renderstate.c | ||
| gen7_renderclear.c | ||
| gen7_renderclear.h | ||
| gen7_renderstate.c | ||
| gen8_engine_cs.c | ||
| gen8_engine_cs.h | ||
| gen8_ppgtt.c | ||
| gen8_ppgtt.h | ||
| gen8_renderstate.c | ||
| gen9_renderstate.c | ||
| hsw_clear_kernel.c | ||
| intel_breadcrumbs.c | ||
| intel_breadcrumbs.h | ||
| intel_breadcrumbs_types.h | ||
| intel_context.c | ||
| intel_context.h | ||
| intel_context_param.h | ||
| intel_context_sseu.c | ||
| intel_context_types.h | ||
| intel_engine.h | ||
| intel_engine_cs.c | ||
| intel_engine_heartbeat.c | ||
| intel_engine_heartbeat.h | ||
| intel_engine_pm.c | ||
| intel_engine_pm.h | ||
| intel_engine_regs.h | ||
| intel_engine_stats.h | ||
| intel_engine_types.h | ||
| intel_engine_user.c | ||
| intel_engine_user.h | ||
| intel_execlists_submission.c | ||
| intel_execlists_submission.h | ||
| intel_ggtt.c | ||
| intel_ggtt_fencing.c | ||
| intel_ggtt_fencing.h | ||
| intel_ggtt_gmch.c | ||
| intel_ggtt_gmch.h | ||
| intel_gpu_commands.h | ||
| intel_gsc.c | ||
| intel_gsc.h | ||
| intel_gt.c | ||
| intel_gt.h | ||
| intel_gt_buffer_pool.c | ||
| intel_gt_buffer_pool.h | ||
| intel_gt_buffer_pool_types.h | ||
| intel_gt_ccs_mode.c | ||
| intel_gt_ccs_mode.h | ||
| intel_gt_clock_utils.c | ||
| intel_gt_clock_utils.h | ||
| intel_gt_debugfs.c | ||
| intel_gt_debugfs.h | ||
| intel_gt_defines.h | ||
| intel_gt_engines_debugfs.c | ||
| intel_gt_engines_debugfs.h | ||
| intel_gt_irq.c | ||
| intel_gt_irq.h | ||
| intel_gt_mcr.c | ||
| intel_gt_mcr.h | ||
| intel_gt_pm.c | ||
| intel_gt_pm.h | ||
| intel_gt_pm_debugfs.c | ||
| intel_gt_pm_debugfs.h | ||
| intel_gt_pm_irq.c | ||
| intel_gt_pm_irq.h | ||
| intel_gt_print.h | ||
| intel_gt_regs.h | ||
| intel_gt_requests.c | ||
| intel_gt_requests.h | ||
| intel_gt_sysfs.c | ||
| intel_gt_sysfs.h | ||
| intel_gt_sysfs_pm.c | ||
| intel_gt_sysfs_pm.h | ||
| intel_gt_types.h | ||
| intel_gtt.c | ||
| intel_gtt.h | ||
| intel_hwconfig.h | ||
| intel_llc.c | ||
| intel_llc.h | ||
| intel_llc_types.h | ||
| intel_lrc.c | ||
| intel_lrc.h | ||
| intel_lrc_reg.h | ||
| intel_migrate.c | ||
| intel_migrate.h | ||
| intel_migrate_types.h | ||
| intel_mocs.c | ||
| intel_mocs.h | ||
| intel_ppgtt.c | ||
| intel_rc6.c | ||
| intel_rc6.h | ||
| intel_rc6_types.h | ||
| intel_region_lmem.c | ||
| intel_region_lmem.h | ||
| intel_renderstate.c | ||
| intel_renderstate.h | ||
| intel_reset.c | ||
| intel_reset.h | ||
| intel_reset_types.h | ||
| intel_ring.c | ||
| intel_ring.h | ||
| intel_ring_submission.c | ||
| intel_ring_types.h | ||
| intel_rps.c | ||
| intel_rps.h | ||
| intel_rps_types.h | ||
| intel_sa_media.c | ||
| intel_sa_media.h | ||
| intel_sseu.c | ||
| intel_sseu.h | ||
| intel_sseu_debugfs.c | ||
| intel_sseu_debugfs.h | ||
| intel_timeline.c | ||
| intel_timeline.h | ||
| intel_timeline_types.h | ||
| intel_tlb.c | ||
| intel_tlb.h | ||
| intel_wopcm.c | ||
| intel_wopcm.h | ||
| intel_workarounds.c | ||
| intel_workarounds.h | ||
| intel_workarounds_types.h | ||
| ivb_clear_kernel.c | ||
| mock_engine.c | ||
| mock_engine.h | ||
| selftest_context.c | ||
| selftest_engine.c | ||
| selftest_engine.h | ||
| selftest_engine_cs.c | ||
| selftest_engine_heartbeat.c | ||
| selftest_engine_heartbeat.h | ||
| selftest_engine_pm.c | ||
| selftest_execlists.c | ||
| selftest_gt_pm.c | ||
| selftest_hangcheck.c | ||
| selftest_llc.c | ||
| selftest_llc.h | ||
| selftest_lrc.c | ||
| selftest_migrate.c | ||
| selftest_mocs.c | ||
| selftest_rc6.c | ||
| selftest_rc6.h | ||
| selftest_reset.c | ||
| selftest_ring.c | ||
| selftest_ring_submission.c | ||
| selftest_rps.c | ||
| selftest_rps.h | ||
| selftest_slpc.c | ||
| selftest_timeline.c | ||
| selftest_tlb.c | ||
| selftest_workarounds.c | ||
| shmem_utils.c | ||
| shmem_utils.h | ||
| st_shmem_utils.c | ||
| sysfs_engines.c | ||
| sysfs_engines.h | ||