All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH RESEND] sched: Move some scheduler fields to new static branch API
@ 2026-08-19  8:09 Hongyan Xia
  2026-08-19  8:44 ` Peter Zijlstra
  0 siblings, 1 reply; 5+ messages in thread
From: Hongyan Xia @ 2026-08-19  8:09 UTC (permalink / raw)
  To: Ingo Molnar, Peter Zijlstra, Juri Lelli, Vincent Guittot,
	Dietmar Eggemann, Steven Rostedt, Ben Segall, Mel Gorman,
	Valentin Schneider, K Prateek Nayak
  Cc: Jiazi Li, linux-kernel@vger.kernel.org

From: Hongyan Xia <hongyan.xia@transsion.com>

__cfs_bandwidth_used uses struct static_key directly which is
deprecated. Fix.

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.

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)
 
 # 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);
 }
 
 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)
-- 
2.47.3


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH RESEND] sched: Move some scheduler fields to new static branch API
  2026-08-19  8:09 [PATCH RESEND] sched: Move some scheduler fields to new static branch API Hongyan Xia
@ 2026-08-19  8:44 ` Peter Zijlstra
  2026-08-19  9:04   ` Hongyan Xia
  0 siblings, 1 reply; 5+ messages in thread
From: Peter Zijlstra @ 2026-08-19  8:44 UTC (permalink / raw)
  To: Hongyan Xia
  Cc: Ingo Molnar, Juri Lelli, Vincent Guittot, Dietmar Eggemann,
	Steven Rostedt, Ben Segall, Mel Gorman, Valentin Schneider,
	K Prateek Nayak, Jiazi Li, linux-kernel@vger.kernel.org

On Wed, Aug 19, 2026 at 08:09:38AM +0000, Hongyan Xia wrote:
> From: Hongyan Xia <hongyan.xia@transsion.com>
> 
> __cfs_bandwidth_used uses struct static_key directly which is
> deprecated. Fix.
> 
> 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.
> 
> No functional change.
> 
> Signed-off-by: Hongyan Xia <hongyan.xia@transsion.com>
> ---

Your emails are encoded in a Microsoft special quoted-printable that my
scripts don't like.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH RESEND] sched: Move some scheduler fields to new static branch API
  2026-08-19  8:44 ` Peter Zijlstra
@ 2026-08-19  9:04   ` Hongyan Xia
  2026-08-19  9:28     ` Peter Zijlstra
  0 siblings, 1 reply; 5+ messages in thread
From: Hongyan Xia @ 2026-08-19  9:04 UTC (permalink / raw)
  To: Peter Zijlstra
  Cc: Ingo Molnar, Juri Lelli, Vincent Guittot, Dietmar Eggemann,
	Steven Rostedt, Ben Segall, Mel Gorman, Valentin Schneider,
	K Prateek Nayak, Jiazi Li, linux-kernel@vger.kernel.org

On 8/19/2026 4:44 PM, Peter Zijlstra wrote:
> On Wed, Aug 19, 2026 at 08:09:38AM +0000, Hongyan Xia wrote:
>> From: Hongyan Xia <hongyan.xia@transsion.com>
>>
>> __cfs_bandwidth_used uses struct static_key directly which is
>> deprecated. Fix.
>>
>> 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.
>>
>> No functional change.
>>
>> Signed-off-by: Hongyan Xia <hongyan.xia@transsion.com>
>> ---
> 
> Your emails are encoded in a Microsoft special quoted-printable that my
> scripts don't like.

Hmm, this patch was sent through the normal git format-patch and 
send-email flow, which looks okay on my end and via lore. Do you have 
more details so that I can debug and avoid triggering future unhappiness 
in your scripts?

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH RESEND] sched: Move some scheduler fields to new static branch API
  2026-08-19  9:04   ` Hongyan Xia
@ 2026-08-19  9:28     ` Peter Zijlstra
  2026-08-19 10:02       ` Hongyan Xia
  0 siblings, 1 reply; 5+ messages in thread
From: Peter Zijlstra @ 2026-08-19  9:28 UTC (permalink / raw)
  To: Hongyan Xia
  Cc: Ingo Molnar, Juri Lelli, Vincent Guittot, Dietmar Eggemann,
	Steven Rostedt, Ben Segall, Mel Gorman, Valentin Schneider,
	K Prateek Nayak, Jiazi Li, linux-kernel@vger.kernel.org

On Wed, Aug 19, 2026 at 09:04:03AM +0000, Hongyan Xia wrote:
> On 8/19/2026 4:44 PM, Peter Zijlstra wrote:
> > On Wed, Aug 19, 2026 at 08:09:38AM +0000, Hongyan Xia wrote:
> >> From: Hongyan Xia <hongyan.xia@transsion.com>
> >>
> >> __cfs_bandwidth_used uses struct static_key directly which is
> >> deprecated. Fix.
> >>
> >> 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.
> >>
> >> No functional change.
> >>
> >> Signed-off-by: Hongyan Xia <hongyan.xia@transsion.com>
> >> ---
> > 
> > Your emails are encoded in a Microsoft special quoted-printable that my
> > scripts don't like.
> 
> Hmm, this patch was sent through the normal git format-patch and 
> send-email flow, which looks okay on my end and via lore. Do you have 
> more details so that I can debug and avoid triggering future unhappiness 
> in your scripts?

I think I fixed the script. But what the thing did was encode '\n' as
=0A=. This is two tokens: "=0A" for the '\n' and then "=$" for a
continuation line.

It does this for every line, including the last line. Marking the last
line as having a continuation resulted in no output, it would just eat
the whole message.

Marking the last line as having a continuation is well, bonkers. But my
script should now be able to deal with it.  Still, pretty idiotic
behaviour on whoever mangled that.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH RESEND] sched: Move some scheduler fields to new static branch API
  2026-08-19  9:28     ` Peter Zijlstra
@ 2026-08-19 10:02       ` Hongyan Xia
  0 siblings, 0 replies; 5+ messages in thread
From: Hongyan Xia @ 2026-08-19 10:02 UTC (permalink / raw)
  To: Peter Zijlstra
  Cc: Ingo Molnar, Juri Lelli, Vincent Guittot, Dietmar Eggemann,
	Steven Rostedt, Ben Segall, Mel Gorman, Valentin Schneider,
	K Prateek Nayak, Jiazi Li, linux-kernel@vger.kernel.org

On 8/19/2026 5:28 PM, Peter Zijlstra wrote:
> On Wed, Aug 19, 2026 at 09:04:03AM +0000, Hongyan Xia wrote:
>> On 8/19/2026 4:44 PM, Peter Zijlstra wrote:
>>> On Wed, Aug 19, 2026 at 08:09:38AM +0000, Hongyan Xia wrote:
>>>> From: Hongyan Xia <hongyan.xia@transsion.com>
>>>>
>>>> __cfs_bandwidth_used uses struct static_key directly which is
>>>> deprecated. Fix.
>>>>
>>>> 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.
>>>>
>>>> No functional change.
>>>>
>>>> Signed-off-by: Hongyan Xia <hongyan.xia@transsion.com>
>>>> ---
>>>
>>> Your emails are encoded in a Microsoft special quoted-printable that my
>>> scripts don't like.
>>
>> Hmm, this patch was sent through the normal git format-patch and
>> send-email flow, which looks okay on my end and via lore. Do you have
>> more details so that I can debug and avoid triggering future unhappiness
>> in your scripts?
> 
> I think I fixed the script. But what the thing did was encode '\n' as
> =0A=. This is two tokens: "=0A" for the '\n' and then "=$" for a
> continuation line.
> 
> It does this for every line, including the last line. Marking the last
> line as having a continuation resulted in no output, it would just eat
> the whole message.
> 
> Marking the last line as having a continuation is well, bonkers. But my
> script should now be able to deal with it.  Still, pretty idiotic
> behaviour on whoever mangled that.

I see it now. I sent this patch again to myself and downloaded the mbox. 
No such weird tokens in the original patch but they appear in the mbox I 
received.

A quick search suggests this is a known issue, done during email transit 
by Microsoft. This is too dumb to be true and I am shocked. Thanks a 
million for fixing it on your end.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-08-19 10:02 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-19  8:09 [PATCH RESEND] sched: Move some scheduler fields to new static branch API 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

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.