From: Shrikanth Hegde <sshegde@linux.ibm.com>
To: Hongyan Xia <hongyan.xia@transsion.com>
Cc: Jiazi Li <jiazi.li@transsion.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
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>,
Mark Rutland <mark.rutland@arm.com>
Subject: Re: [PATCH RESEND] sched: Move some scheduler fields to new static branch API
Date: Wed, 19 Aug 2026 17:49:48 +0530 [thread overview]
Message-ID: <ad4a34fa-e923-4725-a42d-ffea6423d2f5@linux.ibm.com> (raw)
In-Reply-To: <20260819080932.11564-1-hongyan.xia@transsion.com>
Hi Hongyan.
On 8/19/26 1:39 PM, Hongyan Xia wrote:
> From: Hongyan Xia <hongyan.xia@transsion.com>
>
> __cfs_bandwidth_used uses struct static_key directly which is
> deprecated. Fix.
A bit of context on why it is deprecated would help.
>
> sk_dynamic_* uses static_key_{enable/disable}(), which aren't really
> deprecated, but take the opportunity to move to the new static_branch_*
> APIs to be consistent.
>
Mark had a series to remove a few of them completely. IIRC only lazy
check will remain.
https://lore.kernel.org/all/20260803191731.3244294-1-mark.rutland@arm.com/
> No functional change.
>
> Signed-off-by: Hongyan Xia <hongyan.xia@transsion.com>
> ---
> Changed in RESEND:
> - Separate the original series into individual patches. They aren't easy
> to review as a series.
> - Move sk_dynamic_* to the new API as well.
>
> kernel/sched/core.c | 18 +++++++++---------
> kernel/sched/fair.c | 8 ++++----
> 2 files changed, 13 insertions(+), 13 deletions(-)
>
> diff --git a/kernel/sched/core.c b/kernel/sched/core.c
> index 96226707c2f6..5c07d53e43b5 100644
> --- a/kernel/sched/core.c
> +++ b/kernel/sched/core.c
> @@ -7933,15 +7933,15 @@ int sched_dynamic_mode(const char *str)
> return -EINVAL;
> }
>
> -# define preempt_dynamic_key_enable(f) static_key_enable(&sk_dynamic_##f.key)
> -# define preempt_dynamic_key_disable(f) static_key_disable(&sk_dynamic_##f.key)
> +# define preempt_dynamic_branch_enable(f) static_branch_enable(&sk_dynamic_##f)
> +# define preempt_dynamic_branch_disable(f) static_branch_disable(&sk_dynamic_##f)
Also, doc doesn't about mention about static_branch_enable vs static_key_enable.
is static_key_enable also deprecated.
>
> # if defined(CONFIG_HAVE_PREEMPT_DYNAMIC_CALL)
> # define preempt_dynamic_enable(f) static_call_update(f, f##_dynamic_enabled)
> # define preempt_dynamic_disable(f) static_call_update(f, f##_dynamic_disabled)
> # elif defined(CONFIG_HAVE_PREEMPT_DYNAMIC_KEY)
> -# define preempt_dynamic_enable(f) preempt_dynamic_key_enable(f)
> -# define preempt_dynamic_disable(f) preempt_dynamic_key_disable(f)
> +# define preempt_dynamic_enable(f) preempt_dynamic_branch_enable(f)
> +# define preempt_dynamic_disable(f) preempt_dynamic_branch_disable(f)
> # else
> # error "Unsupported PREEMPT_DYNAMIC mechanism"
> # endif
> @@ -7959,7 +7959,7 @@ static void __sched_dynamic_update(int mode)
> preempt_dynamic_enable(preempt_schedule);
> preempt_dynamic_enable(preempt_schedule_notrace);
> preempt_dynamic_enable(irqentry_exit_cond_resched);
> - preempt_dynamic_key_disable(preempt_lazy);
> + preempt_dynamic_branch_disable(preempt_lazy);
>
> switch (mode) {
> case preempt_dynamic_none:
> @@ -7968,7 +7968,7 @@ static void __sched_dynamic_update(int mode)
> preempt_dynamic_disable(preempt_schedule);
> preempt_dynamic_disable(preempt_schedule_notrace);
> preempt_dynamic_disable(irqentry_exit_cond_resched);
> - preempt_dynamic_key_disable(preempt_lazy);
> + preempt_dynamic_branch_disable(preempt_lazy);
> if (mode != preempt_dynamic_mode)
> pr_info("Dynamic Preempt: none\n");
> break;
> @@ -7979,7 +7979,7 @@ static void __sched_dynamic_update(int mode)
> preempt_dynamic_disable(preempt_schedule);
> preempt_dynamic_disable(preempt_schedule_notrace);
> preempt_dynamic_disable(irqentry_exit_cond_resched);
> - preempt_dynamic_key_disable(preempt_lazy);
> + preempt_dynamic_branch_disable(preempt_lazy);
> if (mode != preempt_dynamic_mode)
> pr_info("Dynamic Preempt: voluntary\n");
> break;
> @@ -7990,7 +7990,7 @@ static void __sched_dynamic_update(int mode)
> preempt_dynamic_enable(preempt_schedule);
> preempt_dynamic_enable(preempt_schedule_notrace);
> preempt_dynamic_enable(irqentry_exit_cond_resched);
> - preempt_dynamic_key_disable(preempt_lazy);
> + preempt_dynamic_branch_disable(preempt_lazy);
> if (mode != preempt_dynamic_mode)
> pr_info("Dynamic Preempt: full\n");
> break;
> @@ -8001,7 +8001,7 @@ static void __sched_dynamic_update(int mode)
> preempt_dynamic_enable(preempt_schedule);
> preempt_dynamic_enable(preempt_schedule_notrace);
> preempt_dynamic_enable(irqentry_exit_cond_resched);
> - preempt_dynamic_key_enable(preempt_lazy);
> + preempt_dynamic_branch_enable(preempt_lazy);
> if (mode != preempt_dynamic_mode)
> pr_info("Dynamic Preempt: lazy\n");
> break;
> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> index 762dd8a4647c..4b65be5ec471 100644
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -6442,21 +6442,21 @@ entity_tick(struct cfs_rq *cfs_rq, struct sched_entity *curr, int queued)
> #ifdef CONFIG_CFS_BANDWIDTH
>
> #ifdef CONFIG_JUMP_LABEL
> -static struct static_key __cfs_bandwidth_used;
> +static DEFINE_STATIC_KEY_FALSE(__cfs_bandwidth_used);
>
> static inline bool cfs_bandwidth_used(void)
> {
> - return static_key_false(&__cfs_bandwidth_used);
> + return static_branch_unlikely(&__cfs_bandwidth_used);
> }
>
We will still have two left.
core.c: if (static_key_false((¶virt_steal_rq_enabled))) {
cputime.c: if (static_key_false(¶virt_steal_enabled)) {
> void cfs_bandwidth_usage_inc(void)
> {
> - static_key_slow_inc_cpuslocked(&__cfs_bandwidth_used);
> + static_branch_inc_cpuslocked(&__cfs_bandwidth_used);
> }
>
> void cfs_bandwidth_usage_dec(void)
> {
> - static_key_slow_dec_cpuslocked(&__cfs_bandwidth_used);
> + static_branch_dec_cpuslocked(&__cfs_bandwidth_used);
> }
> #else /* !CONFIG_JUMP_LABEL: */
> static bool cfs_bandwidth_used(void)
next prev parent reply other threads:[~2026-08-19 12:20 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-19 8:09 Hongyan Xia
2026-08-19 8:44 ` Peter Zijlstra
2026-08-19 9:04 ` Hongyan Xia
2026-08-19 9:28 ` Peter Zijlstra
2026-08-19 10:02 ` Hongyan Xia
2026-08-19 12:19 ` Shrikanth Hegde [this message]
2026-08-19 12:58 ` Peter Zijlstra
2026-08-20 2:21 ` Hongyan Xia
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=ad4a34fa-e923-4725-a42d-ffea6423d2f5@linux.ibm.com \
--to=sshegde@linux.ibm.com \
--cc=bsegall@google.com \
--cc=dietmar.eggemann@arm.com \
--cc=hongyan.xia@transsion.com \
--cc=jiazi.li@transsion.com \
--cc=juri.lelli@redhat.com \
--cc=kprateek.nayak@amd.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mgorman@suse.de \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--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®