All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrea Righi <arighi@nvidia.com>
To: Tejun Heo <tj@kernel.org>
Cc: sched-ext@lists.linux.dev, David Vernet <void@manifault.com>,
	Changwoo Min <changwoo@igalia.com>,
	Emil Tsalapatis <emil@etsalapatis.com>,
	David Dai <david.dai@linux.dev>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 5/6] sched_ext: Report the ecaps loss when a cpu goes offline
Date: Sun, 18 Oct 2026 08:49:49 +0200	[thread overview]
Message-ID: <atRsDV9T_lJpgWs-@gpd4> (raw)
In-Reply-To: <20261018015952.1499528-6-tj@kernel.org>

Hi Tejun,

On Sat, Oct 17, 2026 at 03:59:51PM -1000, Tejun Heo wrote:
> When a cpu goes offline, a sub-scheduler's effective caps on its cid are
> cleared, but neither the sub-scheduler nor its parent is notified. The
> sub-scheduler keeps treating the cid as usable, and the parent can't act on
> the loss, e.g. reset the cpuperf target.
> 
> Report the loss before the root's ops.cpu_offline() and the regain after its
> ops.cpu_online(). The zeroing at offline was the last change to a sched's
> ecaps outside a delivery, so they now change only with one. Syncs on an
> inactive cpu are processed instead of discarded, and the reseed reschedules
> the cpu itself, as they got no resched when queued. Suspend and hibernation
> now report their cpu downs and ups as well. This is temporary, and a later
> patch leaves them out.
> 
> Two things need care. A cpu going down marks a sync for each sub-scheduler,
> and its hotplug thread waits until each marked sync has been processed. The
> cpu's own ext picks process them, and the ext server is started in case a
> fair task holds the cpu. Only the marked syncs count, so a flood of changes
> on the cid can't hold up the hotplug.
> 
> The detach report reaches only active cpus. It holds off cpu hotplug, so a
> cpu it skips has reported its loss as it went down, and no unreported loss
> is left to drop.
> 
> Drop the cpuperf reset from scx_qmap's ops.sub_detach(), as its
> ops.sub_child_ecaps_updated() now resets the targets on the loss reports.
> 
> v2: Reschedule from the irq work and document the regain order.
> 
> Signed-off-by: Tejun Heo <tj@kernel.org>
> ---
...
> diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
> index 05cf0f0056e9..59dfe7999603 100644
> --- a/kernel/sched/sched.h
> +++ b/kernel/sched/sched.h
> @@ -846,6 +846,7 @@ struct scx_rq {
>  	/* sched of the open running session, see scx_cid_sched_update() */
>  	struct scx_sched	*sched;
>  	struct llist_head	ecaps_to_sync;		/* pending ecaps syncs */
> +	u32			nr_ecaps_offline;	/* marked syncs a down waits for */
>  	struct task_struct	*sub_dispatch_prev;
>  #endif
>  	cpumask_var_t		cpus_to_sync;

nit: nr_ecaps_offline lands between two 8-byte aligned fields, which adds
a 4-byte hole and shifts everything after it (kick_sync included) by 8
bytes. Can we move it next to kick_sync_pending instead? Something like:

#ifdef CONFIG_EXT_SUB_SCHED
	/* sched of the open running session, see scx_cid_sched_update() */
	struct scx_sched        *sched;
	struct llist_head       ecaps_to_sync;          /* pending ecaps syncs */
	struct task_struct      *sub_dispatch_prev;
	u32                     nr_ecaps_offline;       /* marked syncs a down waits for */
#endif
	bool                    kick_sync_pending;
	cpumask_var_t           cpus_to_sync;
	unsigned long           kick_sync;

This way the u32 and the bool share the existing hole, and kick_sync and
the following fields keep their current offsets.

Thanks,
-Andrea

  reply	other threads:[~2026-10-18  6:50 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-18  1:59 [PATCHSET v3 sched_ext/for-7.4] sched_ext: Report a sub-scheduler's ecaps on attach, detach and cpu hotplug Tejun Heo
2026-10-18  1:59 ` [PATCH 1/6] sched_ext: Factor out cid_pshard() Tejun Heo
2026-10-18  1:59 ` [PATCH 2/6] sched_ext: Free a sub-scheduler a grace period after discarding its ecaps syncs Tejun Heo
2026-10-18  6:56   ` Andrea Righi
2026-10-18  8:16     ` Tejun Heo
2026-10-18  9:17       ` Andrea Righi
2026-10-18  1:59 ` [PATCH 3/6] sched_ext: Report a sub-scheduler's ecaps on attach and detach Tejun Heo
2026-10-18  1:59 ` [PATCH 4/6] sched_ext: Deliver ecaps only while the root has the cpu online Tejun Heo
2026-10-18  1:59 ` [PATCH 5/6] sched_ext: Report the ecaps loss when a cpu goes offline Tejun Heo
2026-10-18  6:49   ` Andrea Righi [this message]
2026-10-18  8:15     ` Tejun Heo
2026-10-18  7:01   ` Andrea Righi
2026-10-18  8:16     ` Tejun Heo
2026-10-18  9:18       ` Andrea Righi
2026-10-18  8:22   ` [PATCH v3 " Tejun Heo
2026-10-18  1:59 ` [PATCH 6/6] sched_ext: Leave suspend and hibernation out of the ecaps reports Tejun Heo
2026-10-18  9:19 ` [PATCHSET v3 sched_ext/for-7.4] sched_ext: Report a sub-scheduler's ecaps on attach, detach and cpu hotplug Andrea Righi
  -- strict thread matches above, loose matches on Subject: below --
2026-10-17 16:45 [PATCHSET v2 " Tejun Heo
2026-10-17 16:45 ` [PATCH 5/6] sched_ext: Report the ecaps loss when a cpu goes offline Tejun Heo
2026-10-17 18:14   ` sashiko-bot
2026-10-17 18:43     ` 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=atRsDV9T_lJpgWs-@gpd4 \
    --to=arighi@nvidia.com \
    --cc=changwoo@igalia.com \
    --cc=david.dai@linux.dev \
    --cc=emil@etsalapatis.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sched-ext@lists.linux.dev \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.