mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Li kunyu <likunyu@open-hieco.net>
To: Qiliang Yuan <qiliang.yuan@linux.dev>,
	Ingo Molnar <mingo@redhat.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Juri Lelli <juri.lelli@redhat.com>,
	Vincent Guittot <vincent.guittot@linaro.org>,
	Dietmar Eggemann <dietmar.eggemann@arm.com>,
	Steven Rostedt <rostedt@goodmis.org>,
	Ben Segall <bsegall@google.com>, Mel Gorman <mgorman@suse.de>,
	Valentin Schneider <vschneid@redhat.com>,
	K Prateek Nayak <kprateek.nayak@amd.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 1/3] sched: Give root domain moves their own sched_class callbacks
Date: Mon, 23 Nov 2026 13:56:55 +0800	[thread overview]
Message-ID: <a8196fdd-9b96-2479-9b5d-9bdc8be3cf7f@open-hieco.net> (raw)
In-Reply-To: <20261120-bug-sched-fair-offline-active-v3-1-325e9eefa56d@linux.dev>

Hi Qiliang,

On 2026/11/21 10:57, Qiliang Yuan wrote:
> --- a/kernel/sched/core.c
> +++ b/kernel/sched/core.c
> @@ -8553,6 +8553,8 @@ void set_rq_online(struct rq *rq)
>  		rq->online = 1;
>  
>  		for_each_class(class) {
> +			if (class->rq_attach_root)
> +				class->rq_attach_root(rq);
>  			if (class->rq_online)
>  				class->rq_online(rq);
>  		}
> @@ -8569,6 +8571,8 @@ void set_rq_offline(struct rq *rq)
>  		for_each_class(class) {
>  			if (class->rq_offline)
>  				class->rq_offline(rq);
> +			if (class->rq_detach_root)
> +				class->rq_detach_root(rq);
>  		}
>  
> 
>  /* Assumes rq->lock is held */
> -static void rq_offline_dl(struct rq *rq)
> +static void rq_detach_root_dl(struct rq *rq)
>  {
>  	if (rq->dl.overloaded)
>  		dl_clear_overload(rq);
> @@ -3664,8 +3664,8 @@ DEFINE_SCHED_CLASS(dl) = {
>  	.select_task_rq		= select_task_rq_dl,
>  	.migrate_task_rq	= migrate_task_rq_dl,
>  	.set_cpus_allowed       = set_cpus_allowed_dl,
> -	.rq_online              = rq_online_dl,
> -	.rq_offline             = rq_offline_dl,
> +	.rq_attach_root		= rq_attach_root_dl,
> +	.rq_detach_root		= rq_detach_root_dl,
>  	.task_woken		= task_woken_dl,
>  	.find_lock_rq		= find_lock_later_rq,
>  
> 
> diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c
> index 81a71aa5f094a..45d10334f7253 100644
> --- a/kernel/sched/rt.c
> +++ b/kernel/sched/rt.c
> @@ -2398,7 +2398,7 @@ static void task_woken_rt(struct rq *rq, struct task_struct *p)
>  }
>  
>  /* Assumes rq->lock is held */
> -static void rq_online_rt(struct rq *rq)
> +static void rq_attach_root_rt(struct rq *rq)
>  {
>  	if (rq->rt.overloaded)
>  		rt_set_overload(rq);
> @@ -2409,7 +2409,7 @@ static void rq_online_rt(struct rq *rq)
>  }
>  
>  /* Assumes rq->lock is held */
> -static void rq_offline_rt(struct rq *rq)
> +static void rq_detach_root_rt(struct rq *rq)
>  {
>  	if (rq->rt.overloaded)
>  		rt_clear_overload(rq);
> @@ -2626,8 +2626,8 @@ DEFINE_SCHED_CLASS(rt) = {
>  	.balance		= balance_rt,
>  	.select_task_rq		= select_task_rq_rt,
>  	.set_cpus_allowed       = set_cpus_allowed_common,
> -	.rq_online              = rq_online_rt,
> -	.rq_offline             = rq_offline_rt,
> +	.rq_attach_root		= rq_attach_root_rt,
> +	.rq_detach_root		= rq_detach_root_rt,
> 
> +	/*
> +	 * Move an online rq to or from a root domain: rq->lock
> +	 */
> +	void (*rq_attach_root)(struct rq *rq);
> +	void (*rq_detach_root)(struct rq *rq);
> +

The newly introduced abstraction function cleanly separates the RT and DL
handling of the root domain, while leaving the CFS scheduling class entirely
unaffected, resulting in a well-structured design.

-- 
thanks,
kunyu

  reply	other threads:[~2026-11-23  5:57 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-21  2:57 [PATCH v3 0/3] sched/fair: Cut per-group work from sched domain rebuilds Qiliang Yuan
2026-11-21  2:57 ` [PATCH v3 1/3] sched: Give root domain moves their own sched_class callbacks Qiliang Yuan
2026-11-23  5:56   ` Li kunyu [this message]
2026-11-21  2:57 ` [PATCH v3 2/3] sched: Keep CPUs that stay active online across root domain moves Qiliang Yuan
2026-11-21  2:57 ` [PATCH v3 3/3] sched/fair: Drop the active CPU check from unthrottle_offline_cfs_rqs() Qiliang Yuan

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=a8196fdd-9b96-2479-9b5d-9bdc8be3cf7f@open-hieco.net \
    --to=likunyu@open-hieco.net \
    --cc=bsegall@google.com \
    --cc=dietmar.eggemann@arm.com \
    --cc=juri.lelli@redhat.com \
    --cc=kprateek.nayak@amd.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mgorman@suse.de \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=qiliang.yuan@linux.dev \
    --cc=rostedt@goodmis.org \
    --cc=vincent.guittot@linaro.org \
    --cc=vschneid@redhat.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®