The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Shrikanth Hegde <sshegde@linux.ibm.com>
To: linux-kernel@vger.kernel.org, mingo@kernel.org,
	peterz@infradead.org, juri.lelli@redhat.com,
	vincent.guittot@linaro.org, yury.norov@gmail.com,
	kprateek.nayak@amd.com, iii@linux.ibm.com, corbet@lwn.net
Cc: sshegde@linux.ibm.com, tglx@kernel.org,
	gregkh@linuxfoundation.org, pbonzini@redhat.com,
	seanjc@google.com, vschneid@redhat.com, huschle@linux.ibm.com,
	rostedt@goodmis.org, dietmar.eggemann@arm.com,
	maddy@linux.ibm.com, srikar@linux.ibm.com, hdanton@sina.com,
	chleroy@kernel.org, vineeth@bitbyteword.org, frederic@kernel.org,
	arighi@nvidia.com, pauld@redhat.com, christian.loehle@arm.com,
	tj@kernel.org, tommaso.cucinotta@gmail.com, maz@kernel.org,
	rafael@kernel.org, rdunlap@infradead.org, kernellwp@gmail.com,
	linux-doc@vger.kernel.org
Subject: [PATCH v7 00/12] sched, steal_monitor: Introduce cpu_preferred_mask and steal-driven vCPU backoff
Date: Fri, 10 Jul 2026 03:26:36 +0530	[thread overview]
Message-ID: <20260709215648.1246821-1-sshegde@linux.ibm.com> (raw)

Very briefly,
- Maintain set of CPUs which can be used by workload. It is denoted as
  cpu_preferred_mask
- Periodically compute the steal time. If steal time is high/low based
  on the thresholds, either reduce/increase the preferred CPUs. This is
  handled in a new driver called steal_monitor
- If a CPU is marked as non-preferred, push the task running on it if
  possible.
- Use this CPU state in wakeup and load balance to ensure tasks run
  within preferred CPUs.

For more details on idea, problem statement and performance numbers,
please refer to cover-letter of v2[2] and OSPM talk[1].

*** Please review and provide your feedback!! ***

[1]:https://youtu.be/adxUKFPlOp0
[2] v2: https://lore.kernel.org/all/20260407191950.643549-1-sshegde@linux.ibm.com/#t
[3] v6: https://lore.kernel.org/all/20260701141654.500125-1-sshegde@linux.ibm.com/#t

Thank you very much for feedback so far. This has helped the code to
evolve towards a clear abstraction layers and get simplified.
Special thanks to Yury Norov for reviewing this and improving the series
significantly. Really appreciated.

Apologies in advance if I have missed addressing any
comments. If so would be purely accidental, not in any way intentional.

base commit:
tip/sched/core at 'commit 04998aa54848 ("sched/eevdf: Delayed dequeue task can't preempt")'

v6->v7:
- Make new driver steal_monitor into 4-5 patches. (Yury Norov)
- Define CONFIG_STEAL_MONITOR and Make it select CONFIG_PREFERRED_CPU
  (Yury Norov)
- Make module parameters fixed at module load (Yury Norov)
- Make module parameters checks using set/get methods via module_param_cb - sashiko
- Simplify is_cpu_allowed. (Yury Norov)
- Added MAINTAINERS entry for new driver.
- Split nohz_full optimization into its own patch.
- Merged load balance patches.
- Use possible CPUs instead of active for steal value calculations.
- Drop __weak symbol for now. Once the need arises, framework can be
  designed at that time. (Yury Norov)
- remove whitespace in scoped_guard (Yury Norov)
- remove class check in sched_push_current_non_preferred_cpu (Yury
  Norov)
- Make empty stub to do { } while (0) in set_cpu_preferred
- Move is_migration_disabled check to sched_non_preferred_cpu_push_stop - Sashiko
- Increase the migration count only if rq changed - sashiko
- Add missing requeue work on early return - sashiko
- Use WARN_ON_ONCE for design checks instead of WARN_ON.
- Few updates to documentation, comments and changelogs.

Let me know if there is any critical information is missing
regarding new driver such as policy, documentation or missing
implementation. I have ensured checkpatch --strict is happy.

Shrikanth Hegde (12):
  sched/docs: Document cpu_preferred_mask and Preferred CPU concept
  cpumask: Introduce cpu_preferred_mask
  sysfs: Add preferred CPU file
  sched/core: Try to use a preferred CPU in is_cpu_allowed
  sched/fair: Load balance only among preferred CPUs
  sched/core: Push current task from non preferred CPU
  sched/debug: Add migration stats due to non preferred CPUs
  virt: Introduce steal monitor driver
  virt/steal_monitor: Add control knobs for handling steal values
  virt/steal_monitor: Provide functions for managing steal values
  virt/steal_monitor: Act on steal time periodically and decide on
    preferred CPUs
  sched, virt/steal_monitor: Keep tick on for faster push on nohz_full
    CPU

 .../ABI/testing/sysfs-devices-system-cpu      |  11 +
 Documentation/driver-api/index.rst            |   1 +
 Documentation/driver-api/steal-monitor.rst    | 111 ++++++++++
 Documentation/scheduler/sched-arch.rst        |  58 +++++
 MAINTAINERS                                   |   9 +
 drivers/base/cpu.c                            |   8 +
 drivers/virt/Kconfig                          |   2 +
 drivers/virt/Makefile                         |   1 +
 drivers/virt/steal_monitor/Kconfig            |  18 ++
 drivers/virt/steal_monitor/Makefile           |   6 +
 drivers/virt/steal_monitor/defaults.c         | 107 ++++++++++
 drivers/virt/steal_monitor/sm_core.c          | 202 ++++++++++++++++++
 drivers/virt/steal_monitor/sm_core.h          |  37 ++++
 include/linux/cpumask.h                       |  24 +++
 include/linux/sched.h                         |   1 +
 kernel/Kconfig.preempt                        |   3 +
 kernel/cpu.c                                  |   6 +
 kernel/sched/core.c                           | 105 ++++++++-
 kernel/sched/debug.c                          |   1 +
 kernel/sched/fair.c                           |  11 +-
 kernel/sched/sched.h                          |  20 ++
 21 files changed, 737 insertions(+), 5 deletions(-)
 create mode 100644 Documentation/driver-api/steal-monitor.rst
 create mode 100644 drivers/virt/steal_monitor/Kconfig
 create mode 100644 drivers/virt/steal_monitor/Makefile
 create mode 100644 drivers/virt/steal_monitor/defaults.c
 create mode 100644 drivers/virt/steal_monitor/sm_core.c
 create mode 100644 drivers/virt/steal_monitor/sm_core.h

-- 
2.47.3


             reply	other threads:[~2026-07-09 21:57 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-09 21:56 Shrikanth Hegde [this message]
2026-07-09 21:56 ` [PATCH v7 01/12] sched/docs: Document cpu_preferred_mask and Preferred CPU concept Shrikanth Hegde
2026-07-09 21:56 ` [PATCH v7 02/12] cpumask: Introduce cpu_preferred_mask Shrikanth Hegde
2026-07-09 21:56 ` [PATCH v7 03/12] sysfs: Add preferred CPU file Shrikanth Hegde
2026-07-10 15:41   ` Yury Norov
2026-07-10 17:00     ` Shrikanth Hegde
2026-07-10 23:09       ` Yury Norov
2026-07-09 21:56 ` [PATCH v7 04/12] sched/core: Try to use a preferred CPU in is_cpu_allowed Shrikanth Hegde
2026-07-09 21:56 ` [PATCH v7 05/12] sched/fair: Load balance only among preferred CPUs Shrikanth Hegde
2026-07-09 21:56 ` [PATCH v7 06/12] sched/core: Push current task from non preferred CPU Shrikanth Hegde
2026-07-10 23:02   ` Yury Norov
2026-07-09 21:56 ` [PATCH v7 07/12] sched/debug: Add migration stats due to non preferred CPUs Shrikanth Hegde
2026-07-09 21:56 ` [PATCH v7 08/12] virt: Introduce steal monitor driver Shrikanth Hegde
2026-07-10  1:27   ` Randy Dunlap
2026-07-10  4:28     ` Shrikanth Hegde
2026-07-10 20:53   ` Yury Norov
2026-07-09 21:56 ` [PATCH v7 09/12] virt/steal_monitor: Add control knobs for handling steal values Shrikanth Hegde
2026-07-10  4:27   ` Shrikanth Hegde
2026-07-09 21:56 ` [PATCH v7 10/12] virt/steal_monitor: Provide functions for managing " Shrikanth Hegde
2026-07-10  4:30   ` Shrikanth Hegde
2026-07-10 20:00   ` Yury Norov
2026-07-09 21:56 ` [PATCH v7 11/12] virt/steal_monitor: Act on steal time periodically and decide on preferred CPUs Shrikanth Hegde
2026-07-10 20:37   ` Yury Norov
2026-07-09 21:56 ` [PATCH v7 12/12] sched, virt/steal_monitor: Keep tick on for faster push on nohz_full CPU Shrikanth Hegde
2026-07-10  6:35   ` Shrikanth Hegde

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=20260709215648.1246821-1-sshegde@linux.ibm.com \
    --to=sshegde@linux.ibm.com \
    --cc=arighi@nvidia.com \
    --cc=chleroy@kernel.org \
    --cc=christian.loehle@arm.com \
    --cc=corbet@lwn.net \
    --cc=dietmar.eggemann@arm.com \
    --cc=frederic@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=hdanton@sina.com \
    --cc=huschle@linux.ibm.com \
    --cc=iii@linux.ibm.com \
    --cc=juri.lelli@redhat.com \
    --cc=kernellwp@gmail.com \
    --cc=kprateek.nayak@amd.com \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maddy@linux.ibm.com \
    --cc=maz@kernel.org \
    --cc=mingo@kernel.org \
    --cc=pauld@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peterz@infradead.org \
    --cc=rafael@kernel.org \
    --cc=rdunlap@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=seanjc@google.com \
    --cc=srikar@linux.ibm.com \
    --cc=tglx@kernel.org \
    --cc=tj@kernel.org \
    --cc=tommaso.cucinotta@gmail.com \
    --cc=vincent.guittot@linaro.org \
    --cc=vineeth@bitbyteword.org \
    --cc=vschneid@redhat.com \
    --cc=yury.norov@gmail.com \
    /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