mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH RFC 0/1] sched: replace the nr_pinned offset access with a per-CPU counter
@ 2026-08-25  4:13 Qiurong Fang
  2026-08-25  4:13 ` [PATCH RFC 1/1] sched: Replace nr_pinned offset hack with a dedicated " Qiurong Fang
  0 siblings, 1 reply; 3+ messages in thread
From: Qiurong Fang @ 2026-08-25  4:13 UTC (permalink / raw)
  To: peterz, mingo
  Cc: juri.lelli, vincent.guittot, dietmar.eggemann, rostedt, bsegall,
	mgorman, vschneid, kprateek.nayak, masahiro, nsc, pmladek,
	linux-kernel, fangqiurong

From: fangqiurong <fangqiurong@kylinos.cn>

378b7708194f inlined migrate_{en,dis}able() into include/linux/sched.h
and reached rq->nr_pinned from there through a generated offset
constant, since struct rq is incomplete in that header. The offset
route was picked as the least ugly of the four options weighed in the
2025-07 bpf-next discussion that led to the commit (Alexei
Starovoitov: reorder the field, RUNTIME_CONST, asm-offsets, a compiler
extension).

This RFC takes that unconsidered path: nr_pinned becomes a plain
per-CPU variable, written with __this_cpu_inc()/__this_cpu_dec() (both
call sites are already preempt-disabled; same plain RMW codegen as the
open-coded access) and read by per_cpu_ptr() + READ_ONCE() in the
single hotplug reader. The offset generator, its Kbuild rule and the
global generated-header include from sched.h go away.

It is a cleanup, not a bug fix, hence no Fixes: or Cc: stable.

Link: https://lore.kernel.org/bpf/CAADnVQ+5sEDKHdsJY5ZsfGDO_1SEhhQWHrt2SMBG5SYyQ+jt7w@mail.gmail.com/
Link: https://lore.kernel.org/lkml/175878730376.709179.17451225747099918958.tip-bot2@tip-bot2/

fangqiurong (1):
  sched: Replace nr_pinned offset hack with a dedicated per-CPU counter

 Kbuild                    | 13 +------------
 include/linux/sched.h     | 30 +++--------------------------
 kernel/sched/core.c       |  3 ++-
 kernel/sched/rq-offsets.c | 12 ------------
 kernel/sched/sched.h      |  1 -
 5 files changed, 6 insertions(+), 53 deletions(-)
 delete mode 100644 kernel/sched/rq-offsets.c

--
2.43.0

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-12-01 19:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-08-25  4:13 [PATCH RFC 0/1] sched: replace the nr_pinned offset access with a per-CPU counter Qiurong Fang
2026-08-25  4:13 ` [PATCH RFC 1/1] sched: Replace nr_pinned offset hack with a dedicated " Qiurong Fang
2026-12-01 19:49   ` Vincent Mailhol

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®