From: Frederic Weisbecker <frederic@kernel.org>
To: LKML <linux-kernel@vger.kernel.org>
Cc: Frederic Weisbecker <frederic@kernel.org>,
Andrew Morton <akpm@linux-foundation.org>,
Peter Zijlstra <peterz@infradead.org>,
Thomas Gleixner <tglx@linutronix.de>
Subject: [PATCH 00/20] kthread: Introduce preferred affinity
Date: Fri, 26 Jul 2024 23:56:36 +0200 [thread overview]
Message-ID: <20240726215701.19459-1-frederic@kernel.org> (raw)
Affining kthreads follow either of three 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.
2) Kthreads that _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.
3) Kthreads that have a _preferred_ affinity but that can run anywhere
without breaking correctness. Userspace can overwrite the affinity.
It is set manually like 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 preferred affinity comes up
or down. Also care must be taken so that the preferred affinity
doesn't cross housekeeping cpumask boundaries.
Currently the preferred affinity pattern has at least 4 identified
users, with more or less success when it comes to handle CPU-hotplug
operations and housekeeping cpumask.
This is a infrastructure proposal to handle this (after cleanups from 01
to 10).
Frederic Weisbecker (20):
arm/bL_switcher: Use kthread_run_on_cpu()
x86/resctrl: Use kthread_run_on_cpu()
firmware: stratix10-svc: Use kthread_run_on_cpu()
scsi: bnx2fc: Use kthread_create_on_cpu()
scsi: bnx2i: Use kthread_create_on_cpu()
scsi: qedi: Use kthread_create_on_cpu()
soc/qman: test: Use kthread_run_on_cpu()
kallsyms: Use kthread_run_on_cpu()
lib: test_objpool: Use kthread_run_on_cpu()
net: pktgen: Use kthread_create_on_node()
kthread: Make sure kthread hasn't started while binding it
kthread: Implement preferred affinity
mm: Make Kcompactd use kthread's preferred affinity
mm: Allocate kcompactd on its node
mm: Make kswapd use kthread's preferred affinity
mm: Allocate kswapd on its node
rcu: Use kthread preferred affinity for RCU boost
kthread: Unify kthread_create_on_cpu() and
kthread_create_worker_on_cpu() automatic format
treewide: Introduce kthread_run_worker[_on_cpu]()
rcu: Use kthread preferred affinity for RCU exp kworkers
arch/arm/common/bL_switcher.c | 10 +-
arch/x86/kernel/cpu/resctrl/pseudo_lock.c | 28 +--
arch/x86/kvm/i8254.c | 2 +-
crypto/crypto_engine.c | 2 +-
drivers/cpufreq/cppc_cpufreq.c | 2 +-
drivers/firmware/stratix10-svc.c | 9 +-
drivers/gpu/drm/drm_vblank_work.c | 2 +-
.../drm/i915/gem/selftests/i915_gem_context.c | 2 +-
drivers/gpu/drm/i915/gt/selftest_execlists.c | 2 +-
drivers/gpu/drm/i915/gt/selftest_hangcheck.c | 2 +-
drivers/gpu/drm/i915/gt/selftest_slpc.c | 2 +-
drivers/gpu/drm/i915/selftests/i915_request.c | 8 +-
drivers/gpu/drm/msm/disp/msm_disp_snapshot.c | 2 +-
drivers/gpu/drm/msm/msm_atomic.c | 2 +-
drivers/gpu/drm/msm/msm_gpu.c | 2 +-
drivers/gpu/drm/msm/msm_kms.c | 2 +-
.../platform/chips-media/wave5/wave5-vpu.c | 2 +-
drivers/net/dsa/mv88e6xxx/chip.c | 2 +-
drivers/net/ethernet/intel/ice/ice_dpll.c | 2 +-
drivers/net/ethernet/intel/ice/ice_gnss.c | 2 +-
drivers/net/ethernet/intel/ice/ice_ptp.c | 2 +-
drivers/platform/chrome/cros_ec_spi.c | 2 +-
drivers/ptp/ptp_clock.c | 2 +-
drivers/scsi/bnx2fc/bnx2fc_fcoe.c | 7 +-
drivers/scsi/bnx2i/bnx2i_init.c | 7 +-
drivers/scsi/qedi/qedi_main.c | 6 +-
drivers/soc/fsl/qbman/qman_test_stash.c | 6 +-
drivers/spi/spi.c | 2 +-
drivers/usb/typec/tcpm/tcpm.c | 2 +-
drivers/vdpa/vdpa_sim/vdpa_sim.c | 2 +-
drivers/watchdog/watchdog_dev.c | 2 +-
fs/erofs/zdata.c | 2 +-
include/linux/cpuhotplug.h | 1 +
include/linux/kthread.h | 56 +++++-
kernel/kallsyms_selftest.c | 4 +-
kernel/kthread.c | 162 +++++++++++++++---
kernel/rcu/tree.c | 94 ++--------
kernel/rcu/tree_plugin.h | 11 +-
kernel/workqueue.c | 2 +-
lib/test_objpool.c | 19 +-
mm/compaction.c | 43 +----
mm/vmscan.c | 8 +-
net/core/pktgen.c | 7 +-
net/dsa/tag_ksz.c | 2 +-
net/dsa/tag_ocelot_8021q.c | 2 +-
net/dsa/tag_sja1105.c | 2 +-
46 files changed, 284 insertions(+), 258 deletions(-)
--
2.45.2
next reply other threads:[~2024-07-26 21:57 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-26 21:56 Frederic Weisbecker [this message]
2024-07-26 21:56 ` [PATCH 01/20] arm/bL_switcher: Use kthread_run_on_cpu() Frederic Weisbecker
2024-08-05 14:44 ` Dave Martin
2024-08-05 14:53 ` Nicolas Pitre
2024-07-26 21:56 ` [PATCH 02/20] x86/resctrl: " Frederic Weisbecker
2024-08-01 20:57 ` Reinette Chatre
2024-07-26 21:56 ` [PATCH 03/20] firmware: stratix10-svc: " Frederic Weisbecker
2024-07-26 21:56 ` [PATCH 04/20] scsi: bnx2fc: Use kthread_create_on_cpu() Frederic Weisbecker
2024-07-26 21:56 ` [PATCH 05/20] scsi: bnx2i: " Frederic Weisbecker
2024-07-26 21:56 ` [PATCH 06/20] scsi: qedi: " Frederic Weisbecker
2024-07-26 21:56 ` [PATCH 07/20] soc/qman: test: Use kthread_run_on_cpu() Frederic Weisbecker
2024-07-26 21:56 ` [PATCH 08/20] kallsyms: " Frederic Weisbecker
2024-07-26 21:56 ` [PATCH 09/20] lib: test_objpool: " Frederic Weisbecker
2024-07-26 21:56 ` [PATCH 10/20] net: pktgen: Use kthread_create_on_node() Frederic Weisbecker
2024-07-26 21:56 ` [RFC PATCH 11/20] kthread: Make sure kthread hasn't started while binding it Frederic Weisbecker
2024-07-30 15:20 ` Vlastimil Babka
2024-07-26 21:56 ` [RFC PATCH 12/20] kthread: Implement preferred affinity Frederic Weisbecker
2024-07-26 22:31 ` Frederic Weisbecker
2024-07-30 15:49 ` Vlastimil Babka
2024-08-05 14:28 ` Frederic Weisbecker
2024-08-05 14:53 ` Vlastimil Babka
2024-08-05 16:23 ` Frederic Weisbecker
2024-08-05 21:25 ` Vlastimil Babka
2024-08-05 23:59 ` Frederic Weisbecker
2024-08-06 11:08 ` Vlastimil Babka
2024-07-26 21:56 ` [RFC PATCH 13/20] mm: Make Kcompactd use kthread's " Frederic Weisbecker
2024-07-31 15:03 ` Vlastimil Babka
2024-07-26 21:56 ` [RFC PATCH 14/20] mm: Allocate kcompactd on its node Frederic Weisbecker
2024-07-31 15:07 ` Vlastimil Babka
2024-08-05 14:30 ` Frederic Weisbecker
2024-07-26 21:56 ` [RFC PATCH 15/20] mm: Make kswapd use kthread's preferred affinity Frederic Weisbecker
2024-07-31 15:08 ` Vlastimil Babka
2024-07-26 21:56 ` [RFC PATCH 16/20] mm: Allocate kswapd on its node Frederic Weisbecker
2024-07-31 15:08 ` Vlastimil Babka
2024-07-26 21:56 ` [RFC PATCH 17/20] rcu: Use kthread preferred affinity for RCU boost Frederic Weisbecker
2024-07-26 21:56 ` [RFC PATCH 18/20] kthread: Unify kthread_create_on_cpu() and kthread_create_worker_on_cpu() automatic format Frederic Weisbecker
2024-07-26 21:56 ` [RFC PATCH 19/20] treewide: Introduce kthread_run_worker[_on_cpu]() Frederic Weisbecker
2024-07-26 21:56 ` [RFC PATCH 20/20] rcu: Use kthread preferred affinity for RCU exp kworkers Frederic Weisbecker
2024-07-26 22:40 ` Paul E. McKenney
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=20240726215701.19459-1-frederic@kernel.org \
--to=frederic@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
/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