The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Tao Cui <cui.tao@linux.dev>
To: tj@kernel.org, void@manifault.com, arighi@nvidia.com
Cc: cui.tao@linux.dev, changwoo@igalia.com, suzhidao@xiaomi.com,
	sched-ext@lists.linux.dev, linux-kernel@vger.kernel.org,
	bpf@vger.kernel.org, Tao Cui <cuitao@kylinos.cn>
Subject: Re: [PATCH v3 2/2] sched_ext: rename tg->scx.idle to tg->scx.sched_idle
Date: Tue, 25 Aug 2026 13:20:44 +0800	[thread overview]
Message-ID: <b53c61a1-4d7d-4232-941f-d48b0563d4ed@linux.dev> (raw)
In-Reply-To: <20260825023557.27881-3-cui.tao@linux.dev>

Hi,

在 2026/8/25 10:35, Tao Cui 写道:
> From: Tao Cui <cuitao@kylinos.cn>
> 
> A bare "idle" reads as CPU idle state in sched_ext (ops.update_idle(),
> idle cpumasks, scx_bpf_pick_idle_cpu()). cpu.idle is the cgroup analog
> of the SCHED_IDLE policy, so name the task_group field sched_idle to
> match scx_cgroup_init_args.sched_idle.
> 
> Pure rename, no behavior change.
> 

While testing this series, I noticed that scx_group_set_idle() delivers
ops.cgroup_set_idle() on every successful cpu.idle write, even rewrites
of the current value, although the kerneldoc says the callback is
invoked on transitions. scx_group_set_weight() and
scx_group_set_bandwidth() both skip unchanged values, so this seems
like an oversight.

The fix is a one-line guard, but it reads the field renamed here, so
I'll post it on top of this series once it lands.

Thanks,
Tao

> Signed-off-by: Tao Cui <cuitao@kylinos.cn>
> ---
>  include/linux/sched/ext.h | 2 +-
>  kernel/sched/ext/ext.c    | 8 ++++----
>  kernel/sched/ext/sub.c    | 4 ++--
>  3 files changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/include/linux/sched/ext.h b/include/linux/sched/ext.h
> index 582d7cd4a983..7b9cdb65deef 100644
> --- a/include/linux/sched/ext.h
> +++ b/include/linux/sched/ext.h
> @@ -323,7 +323,7 @@ struct scx_task_group {
>  	u64			bw_period_us;
>  	u64			bw_quota_us;
>  	u64			bw_burst_us;
> -	bool			idle;
> +	bool			sched_idle;
>  #endif
>  };
>  
> diff --git a/kernel/sched/ext/ext.c b/kernel/sched/ext/ext.c
> index 82cf8f57e15c..4a9c38297093 100644
> --- a/kernel/sched/ext/ext.c
> +++ b/kernel/sched/ext/ext.c
> @@ -4682,7 +4682,7 @@ void scx_tg_init(struct task_group *tg)
>  	tg->scx.weight = CGROUP_WEIGHT_DFL;
>  	tg->scx.bw_period_us = default_bw_period_us();
>  	tg->scx.bw_quota_us = RUNTIME_INF;
> -	tg->scx.idle = false;
> +	tg->scx.sched_idle = false;
>  }
>  
>  /**
> @@ -4765,7 +4765,7 @@ int scx_tg_online(struct task_group *tg)
>  				  .bw_period_us = tg->scx.bw_period_us,
>  				  .bw_quota_us = tg->scx.bw_quota_us,
>  				  .bw_burst_us = tg->scx.bw_burst_us,
> -				  .sched_idle = tg->scx.idle };
> +				  .sched_idle = tg->scx.sched_idle };
>  
>  			ret = SCX_CALL_OP_RET(sch, cgroup_init,
>  					      NULL, tg->css.cgroup, &args);
> @@ -4935,7 +4935,7 @@ void scx_group_set_idle(struct task_group *tg, bool idle)
>  		SCX_CALL_OP(sch, cgroup_set_idle, NULL, tg_cgrp(tg), idle);
>  
>  	/* Update the task group's idle state */
> -	tg->scx.idle = idle;
> +	tg->scx.sched_idle = idle;
>  
>  	percpu_up_read(&scx_cgroup_ops_rwsem);
>  }
> @@ -5186,7 +5186,7 @@ static int scx_cgroup_init(struct scx_sched *sch)
>  				.bw_period_us = tg->scx.bw_period_us,
>  				.bw_quota_us = tg->scx.bw_quota_us,
>  				.bw_burst_us = tg->scx.bw_burst_us,
> -				.sched_idle = tg->scx.idle,
> +				.sched_idle = tg->scx.sched_idle,
>  			};
>  
>  			ret = SCX_CALL_OP_RET(sch, cgroup_init, NULL, css->cgroup, &args);
> diff --git a/kernel/sched/ext/sub.c b/kernel/sched/ext/sub.c
> index 385302d19914..a17d84db93bd 100644
> --- a/kernel/sched/ext/sub.c
> +++ b/kernel/sched/ext/sub.c
> @@ -1361,7 +1361,7 @@ static s32 scx_cgroup_claim_subtree(struct scx_sched *sch)
>  			.bw_period_us = tg->scx.bw_period_us,
>  			.bw_quota_us = tg->scx.bw_quota_us,
>  			.bw_burst_us = tg->scx.bw_burst_us,
> -			.sched_idle = tg->scx.idle,
> +			.sched_idle = tg->scx.sched_idle,
>  		};
>  
>  		if (tg->scx.sched != parent ||
> @@ -1465,7 +1465,7 @@ static void scx_cgroup_return_subtree(struct scx_sched *sch)
>  			.bw_period_us = tg->scx.bw_period_us,
>  			.bw_quota_us = tg->scx.bw_quota_us,
>  			.bw_burst_us = tg->scx.bw_burst_us,
> -			.sched_idle = tg->scx.idle,
> +			.sched_idle = tg->scx.sched_idle,
>  		};
>  
>  		/* the first pass must have transferred everything */


  reply	other threads:[~2026-08-25  5:20 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-25  2:35 [PATCH v3 0/2] sched_ext: pass the initial cpu.idle state in scx_cgroup_init_args Tao Cui
2026-08-25  2:35 ` [PATCH v3 1/2] " Tao Cui
2026-08-25  2:35 ` [PATCH v3 2/2] sched_ext: rename tg->scx.idle to tg->scx.sched_idle Tao Cui
2026-08-25  5:20   ` Tao Cui [this message]
2026-08-25  5:51 ` [PATCH v3 0/2] sched_ext: pass the initial cpu.idle state in scx_cgroup_init_args Andrea Righi

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=b53c61a1-4d7d-4232-941f-d48b0563d4ed@linux.dev \
    --to=cui.tao@linux.dev \
    --cc=arighi@nvidia.com \
    --cc=bpf@vger.kernel.org \
    --cc=changwoo@igalia.com \
    --cc=cuitao@kylinos.cn \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sched-ext@lists.linux.dev \
    --cc=suzhidao@xiaomi.com \
    --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