mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Changwoo Min <changwoo@igalia.com>
To: tj@kernel.org, void@manifault.com, arighi@nvidia.com
Cc: kernel-dev@igalia.com, linux-kernel@vger.kernel.org,
	Changwoo Min <changwoo@igalia.com>
Subject: [PATCH v3 00/11] sched_ext: Implement core event counters
Date: Fri, 31 Jan 2025 16:09:27 +0900	[thread overview]
Message-ID: <20250131070938.95551-1-changwoo@igalia.com> (raw)

The sched_ext core often has to override the BPF scheduler decisions,
and some events could be interesting but not easily visible.

This patchset aims to address such a problem in the following manner:
  - Introduce an infrastructure to collect such events in a scalable and
    extensible way and to expose the collected events to the BPF scheduler
    in a compatible way.
  - Define seven events to be collected.
  - Modify an scx scheduler to demonstrate the usage of the new BPF APIs.

ChangeLog: v2 -> v3
  - Rename scx_bpf_event_stats() to scx_bpf_events().
  - Add a prefix SCX_EV_ to all event names.
  - Change the implementation SCX_EV_SELECT_CPU_FALLBACK such that
    record the selected cpu (p->scx.selected_cpu) in
    select_task_rq_scx() and compare it in enqueue_task_scx() to
    reliably count events.
  - Change the implementation of SCX_EV_BYPASS_DISPATCH such that log
    the event where the condition is initially detected.
  - Modify scx_qmap to print the core event counter every second.
  - Remove unnecessary white space in patch 6.

ChangeLog: v1 -> v2
  - Rename scx_event_stat and scx_bpf_event_stat() to scx_event_stats and
    scx_bpf_event_stats().
  - Rename event names following the convention of $COMPONENT_$EVENT.
  - Rename event_stats to event_stats_cpu.
  - Drop the enum scx_event_kind and related macros.
  - Revise scx_add_event() to use this_cpu_add().
  - Add __scx_add_event() to use __this_cpu_add().
  - Move the event counter resetting code to the loading of a BPF scheduler.
  - The bypass-related event is further categorized into three events:
    BYPASS_ACTIVATE, BYPASS_DISPATCH, and BYPASS_DURATION.
  - Revise SELECT_CPU_FALLBACK to capture the case of the chosen CPU is not
    allowed.
  - Move is_cpu_allowed() from core.c to sched.h to use in the
    SELECT_CPU_FALLBACK code.

Changwoo Min (11):
  sched_ext: Implement event counter infrastructure
  sched_ext: Add an event, SCX_EV_SELECT_CPU_FALLBACK
  sched_ext: Add an event, SCX_EV_DISPATCH_LOCAL_DSQ_OFFLINE
  sched_ext: Add an event, SCX_EV_DISPATCH_KEEP_LAST
  sched_ext: Add an event, SCX_EV_ENQ_SKIP_EXITING
  sched_ext: Add an event, SCX_EV_BYPASS_ACTIVATE
  sched_ext: Add an event, SCX_EV_BYPASS_DISPATCH
  sched_ext: Add an event, SCX_EV_BYPASS_DURATION
  sched_ext: Add scx_bpf_events() and scx_read_event() for BPF
    schedulers
  sched_ext: Print core event count in scx_central scheduler
  sched_ext: Print core event count in scx_qmap scheduler

 include/linux/sched/ext.h                |   1 +
 kernel/sched/ext.c                       | 197 ++++++++++++++++++++++-
 tools/sched_ext/include/scx/common.bpf.h |   4 +
 tools/sched_ext/scx_central.bpf.c        |  21 +++
 tools/sched_ext/scx_qmap.bpf.c           |  19 +++
 5 files changed, 237 insertions(+), 5 deletions(-)

-- 
2.48.1


             reply	other threads:[~2025-01-31  7:09 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-31  7:09 Changwoo Min [this message]
2025-01-31  7:09 ` [PATCH v3 01/11] sched_ext: Implement event counter infrastructure Changwoo Min
2025-01-31  7:09 ` [PATCH v3 02/11] sched_ext: Add an event, SCX_EV_SELECT_CPU_FALLBACK Changwoo Min
2025-02-02 17:34   ` Tejun Heo
2025-01-31  7:09 ` [PATCH v3 03/11] sched_ext: Add an event, SCX_EV_DISPATCH_LOCAL_DSQ_OFFLINE Changwoo Min
2025-01-31  7:09 ` [PATCH v3 04/11] sched_ext: Add an event, SCX_EV_DISPATCH_KEEP_LAST Changwoo Min
2025-02-02 17:24   ` Tejun Heo
2025-01-31  7:09 ` [PATCH v3 05/11] sched_ext: Add an event, SCX_EV_ENQ_SKIP_EXITING Changwoo Min
2025-02-02 17:20   ` Tejun Heo
2025-02-03 15:46     ` Changwoo Min
2025-01-31  7:09 ` [PATCH v3 06/11] sched_ext: Add an event, SCX_EV_BYPASS_ACTIVATE Changwoo Min
2025-01-31  7:09 ` [PATCH v3 07/11] sched_ext: Add an event, SCX_EV_BYPASS_DISPATCH Changwoo Min
2025-02-02 17:33   ` Tejun Heo
2025-02-03 15:51     ` Changwoo Min
2025-01-31  7:09 ` [PATCH v3 08/11] sched_ext: Add an event, SCX_EV_BYPASS_DURATION Changwoo Min
2025-02-02 17:35   ` Tejun Heo
2025-02-03 15:48     ` Changwoo Min
2025-01-31  7:09 ` [PATCH v3 09/11] sched_ext: Add scx_bpf_events() and scx_read_event() for BPF schedulers Changwoo Min
2025-01-31  7:09 ` [PATCH v3 10/11] sched_ext: Print core event count in scx_central scheduler Changwoo Min
2025-01-31  7:09 ` [PATCH v3 11/11] sched_ext: Print core event count in scx_qmap scheduler Changwoo Min
2025-02-02 17:37 ` [PATCH v3 00/11] sched_ext: Implement core event counters Tejun Heo

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=20250131070938.95551-1-changwoo@igalia.com \
    --to=changwoo@igalia.com \
    --cc=arighi@nvidia.com \
    --cc=kernel-dev@igalia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tj@kernel.org \
    --cc=void@manifault.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

all inboxes | Powered by JetHome®