Skip to contentSkip to conversation

sched: Move some scheduler fields to new static branch API

PATCH RESEND In review Hongyan Xia 3 participants 10 messages Aug 19 – Sep 2 Scheduler

lore
Share & tools
lore
#0 lore raw

PATCH RESEND 1/1 sched: Move some scheduler fields to new static branch API

From: Hongyan Xia <[email protected]>

__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.

---
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(-)
kernel/sched/core.c +9 -9
index 96226707c2f6..5c07d53e43b5 100644
@@ -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;
kernel/sched/fair.c +4 -4
index 762dd8a4647c..4b65be5ec471 100644
@@ -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)
Signature · 1 line
2.47.3
maintainer
#1 lore raw
Quoted 5 lines · Hongyan Xia

From: Hongyan Xia <[email protected]>

__cfs_bandwidth_used uses struct static_key directly which is deprecated. Fix.

Quoted 8 lines

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.

---

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

#2 lore raw
Quoted 10 lines · Peter Zijlstra
Quoted 9 lines · Hongyan Xia

From: Hongyan Xia <[email protected]>

__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.

Quoted 7 lines
Quoted 4 lines

No functional change.

---

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?

maintainer
#3 lore raw
Quoted 16 lines · Hongyan Xia
Quoted 15 lines · Peter Zijlstra
Quoted 13 lines · Hongyan Xia

From: Hongyan Xia <[email protected]>

__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.

---

Quoted 7 lines
Quoted 2 lines

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.

#4 lore raw
Quoted 29 lines · Peter Zijlstra
Quoted 16 lines · Hongyan Xia
Quoted 15 lines · Peter Zijlstra
Quoted 13 lines · Hongyan Xia

From: Hongyan Xia <[email protected]>

__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.

---

Quoted 7 lines
Quoted 2 lines

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.

Quoted 7 lines

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.

#5 lore raw
In reply to Peter Zijlstra

Hi Peter,

Quoted 29 lines · Peter Zijlstra
Quoted 16 lines · Hongyan Xia
Quoted 15 lines · Peter Zijlstra
Quoted 13 lines · Hongyan Xia

From: Hongyan Xia <[email protected]>

__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.

---

Quoted 7 lines
Quoted 2 lines

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.

Quoted 7 lines

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.

While working on the latest sched/core, I noticed two of my patches

d92d1a182dc2d5dc5e4418765739f56bcbde806a, and
087b40fe5934e4b8aa80b29b3debbd6542756ffd

have both changed my name into

Author: Hongyan Xia =0A= <[email protected]>

While =0A= is certainly a cute last name, I want to ask if this has anything to do with the Outlook fix you mentioned last time. If not, I'll see what else could have gone wrong.

maintainer
#6 lore raw
Quoted 45 lines · Hongyan Xia

Hi Peter,

Quoted 29 lines · Peter Zijlstra
Quoted 16 lines · Hongyan Xia
Quoted 15 lines · Peter Zijlstra
Quoted 13 lines · Hongyan Xia

From: Hongyan Xia <[email protected]>

__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.

---

Quoted 7 lines
Quoted 2 lines

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.

Quoted 7 lines

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.

While working on the latest sched/core, I noticed two of my patches

d92d1a182dc2d5dc5e4418765739f56bcbde806a, and
087b40fe5934e4b8aa80b29b3debbd6542756ffd

Quoted 7 lines

have both changed my name into

Author: Hongyan Xia =0A= <[email protected]>

While =0A= is certainly a cute last name, I want to ask if this has anything to do with the Outlook fix you mentioned last time. If not, I'll see what else could have gone wrong.

Argh, sorry about that. Sometimes I fail to spot issues like this. Let me go rebase those patches and fix.

#7 lore raw
In reply to Hongyan Xia

Hi Hongyan.

Quoted 4 lines · Hongyan Xia

From: Hongyan Xia <[email protected]>

__cfs_bandwidth_used uses struct static_key directly which is deprecated. Fix.

A bit of context on why it is deprecated would help.

Quoted 5 lines

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/[email protected]/

Quoted 18 lines

No functional change.

---
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(-)
kernel/sched/core.c +0 -0
index 96226707c2f6..5c07d53e43b5 100644

kernel/sched/core.c int sched_dynamic_mode(const char *str) · line 7937

Quoted 7 lines
kernel/sched/core.c +2 -2
@@ -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.

Quoted 64 lines
kernel/sched/core.c +7 -7
  # 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;
kernel/sched/fair.c +0 -0
index 762dd8a4647c..4b65be5ec471 100644
@@ -6442,21 +6442,21 @@ entity_tick(struct cfs_rq *cfs_rq, struct sched_entity *curr, int queued)
  #ifdef CONFIG_CFS_BANDWIDTH
 

kernel/sched/fair.c entity_tick(struct cfs_rq *cfs_rq, struct sched_entity *curr, int queued) · line 6451

Quoted 10 lines
kernel/sched/fair.c +2 -2
  #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((&paravirt_steal_rq_enabled))) {
cputime.c: if (static_key_false(&paravirt_steal_enabled)) {

Quoted 13 lines
kernel/sched/fair.c +2 -2
  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)
maintainer
#8 lore raw
Quoted 11 lines · Shrikanth Hegde

Hi Hongyan.

Quoted 4 lines · Hongyan Xia

From: Hongyan Xia <[email protected]>

__cfs_bandwidth_used uses struct static_key directly which is deprecated. Fix.

A bit of context on why it is deprecated would help.

Quoted 1 line
Quoted 7 lines
Quoted 4 lines

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.

Yeah, I have those pending. I'll smash everything together and see where the pieces fall post -rc1.

#9 lore raw
In reply to Shrikanth Hegde
Quoted 10 lines · Shrikanth Hegde

Hi Hongyan.

Quoted 4 lines · Hongyan Xia

From: Hongyan Xia <[email protected]>

__cfs_bandwidth_used uses struct static_key directly which is deprecated. Fix.

A bit of context on why it is deprecated would help.

Sure. Will add some context in the next rev.

Quoted 6 lines
Quoted 5 lines

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.

Quoted 7 lines

Mark had a series to remove a few of them completely. IIRC only lazy check will remain.

https://apc01.safelinks.protection.outlook.com/?
url=https%3A%2F%2Flore.kernel.org%2Fall%2F20260803191731.3244294-1- mark.rutland%40arm.com%2F&data=05%7C02%7Chongyan.xia%40transsion.com%7C65194a86312643aed75b08defdec3f5a%7C2e8503a62d0143338e366ab7c8cd7ae2%7C0%7C0%7C639227388298975336%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=KbAcWOiQg%2Bir4%2FzKW2KG66IkxSnbq79m2I9IUlLe4os%3D&reserved=0

I see. These two do conflict. Would be nice if Mark's patch gets merged first, then it makes this diff smaller.

Quoted 21 lines
Quoted 21 lines

No functional change.

---
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(-)
kernel/sched/core.c +0 -0
index 96226707c2f6..5c07d53e43b5 100644
@@ -7933,15 +7933,15 @@ int sched_dynamic_mode(const char *str)
       return -EINVAL;
   }
 
Quoted 12 lines

kernel/sched/core.c int sched_dynamic_mode(const char *str) · line 7941

Quoted 8 lines
kernel/sched/core.c +2 -2
-# 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.

Right, like mentioned in the commit message, this change here is a nice-to-have, not really deprecation. The trend is to move from untyped static_key_* variants to typed static_branch_* ones, so I took the opportunity to fix it.

Quoted 81 lines
Quoted 67 lines
kernel/sched/core.c +2 -2
   # 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
kernel/sched/core.c +1 -1
@@ -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:

kernel/sched/core.c +4 -4
@@ -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;
kernel/sched/fair.c +0 -0
index 762dd8a4647c..4b65be5ec471 100644
@@ -6442,21 +6442,21 @@ entity_tick(struct cfs_rq *cfs_rq, struct 
 sched_entity *curr, int queued)
   #ifdef CONFIG_CFS_BANDWIDTH
 

kernel/sched/fair.c entity_tick(struct cfs_rq *cfs_rq, struct · line 6452

Quoted 10 lines
kernel/sched/fair.c +2 -2
   #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.

Quoted 3 lines

core.c: if (static_key_false((&paravirt_steal_rq_enabled))) { cputime.c:      if (static_key_false(&paravirt_steal_enabled)) {

That has been sent, at

https://lore.kernel.org/all/[email protected]/

That touches all archs and may need review from Xen folks, so I split it into a separate patch.

Quoted 14 lines
Quoted 13 lines
kernel/sched/fair.c +2 -2
   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)