Skip to contentSkip to conversation

sched: Change the name of preempt mode from full to low_latency

PATCH In review Yajun Deng 2 participants 2 messages Sep 11, 2023

Subsystems (3)
lore
Share & tools
lore

Yajun Deng

author
#0 lore raw

PATCH 1/1 sched: Change the name of preempt mode from full to low_latency

There is a similar name fully in Kconfig.preempt, but it corresponds to PREEMPT_RT. In order to distinguish them, change the name of preempt mode from full to low_latency.

Also, define a global array and variable that used to save preempt mode name and size.

---
 .../admin-guide/kernel-parameters.txt         |  2 +-
 include/linux/sched.h                         |  8 ++--
 kernel/sched/core.c                           | 43 ++++++++++---------
 kernel/sched/debug.c                          |  5 +--
 kernel/sched/sched.h                          |  2 +
 kernel/trace/trace.c                          |  4 +-
 6 files changed, 32 insertions(+), 32 deletions(-)
Documentation/admin-guide/kernel-parameters.txt +1 -1
index 0a1731a0f0ef..9284fd7999d7 100644
@@ -4581,7 +4581,7 @@
 			Select preemption mode if you have CONFIG_PREEMPT_DYNAMIC
 			none - Limited to cond_resched() calls
 			voluntary - Limited to cond_resched() and might_sleep() calls
-			full - Any section that isn't explicitly preempt disabled
+			low_latency - Any section that isn't explicitly preempt disabled
 			       can be preempted anytime.
 
 	print-fatal-signals=
include/linux/sched.h +4 -4
index 6d1341b1673f..ea607a0ce6f6 100644
@@ -2181,7 +2181,7 @@ static inline void cond_resched_rcu(void)
 
 extern bool preempt_model_none(void);
 extern bool preempt_model_voluntary(void);
-extern bool preempt_model_full(void);
+extern bool preempt_model_low_latency(void);
 
 #else
 
@@ -2193,14 +2193,14 @@ static inline bool preempt_model_voluntary(void)
 {
 	return IS_ENABLED(CONFIG_PREEMPT_VOLUNTARY);
 }
-static inline bool preempt_model_full(void)
+static inline bool preempt_model_low_latency(void)
 {
 	return IS_ENABLED(CONFIG_PREEMPT);
 }
 
 #endif
 
-static inline bool preempt_model_rt(void)
+static inline bool preempt_model_fully(void)
 {
 	return IS_ENABLED(CONFIG_PREEMPT_RT);
 }
@@ -2215,7 +2215,7 @@ static inline bool preempt_model_rt(void)
  */
 static inline bool preempt_model_preemptible(void)
 {
-	return preempt_model_full() || preempt_model_rt();
+	return preempt_model_low_latency() || preempt_model_fully();
 }
 
 /*
kernel/sched/core.c +22 -21

102 lines not on this page · raw message

kernel/sched/debug.c +1 -4
index 4c3d0d9f3db6..fd516dcff988 100644
@@ -244,12 +244,9 @@ static ssize_t sched_dynamic_write(struct file *filp, const char __user *ubuf,
 
 static int sched_dynamic_show(struct seq_file *m, void *v)
 {
-	static const char * preempt_modes[] = {
-		"none", "voluntary", "full"
-	};
 	int i;
 
-	for (i = 0; i < ARRAY_SIZE(preempt_modes); i++) {
+	for (i = 0; i < preempt_modes_size; i++) {
 		if (preempt_dynamic_mode == i)
 			seq_puts(m, "(");
 		seq_puts(m, preempt_modes[i]);
kernel/sched/sched.h +2 -0
index 04846272409c..6210c40f35da 100644
@@ -3276,6 +3276,8 @@ extern int try_to_wake_up(struct task_struct *tsk, unsigned int state, int wake_
 
 #ifdef CONFIG_PREEMPT_DYNAMIC
 extern int preempt_dynamic_mode;
+extern const char *preempt_modes[];
+extern int preempt_modes_size;
 extern int sched_dynamic_mode(const char *str);
 extern void sched_dynamic_update(int mode);
 #endif
kernel/trace/trace.c +2 -2
index 2b4ded753367..3d731b4fea65 100644
@@ -4394,8 +4394,8 @@ print_trace_header(struct seq_file *m, struct trace_iterator *iter)
 		   buf->cpu,
 		   preempt_model_none()      ? "server" :
 		   preempt_model_voluntary() ? "desktop" :
-		   preempt_model_full()      ? "preempt" :
-		   preempt_model_rt()        ? "preempt_rt" :
+		   preempt_model_low_latency() ? "preempt" :
+		   preempt_model_fully()     ? "preempt_rt" :
 		   "unknown",
 		   /* These are reserved for later use */
 		   0, 0, 0, 0);
Signature · 1 line
2.25.1
maintainer
#1 lore raw
Quoted 6 lines · Yajun Deng

There is a similar name fully in Kconfig.preempt, but it corresponds to PREEMPT_RT. In order to distinguish them, change the name of preempt mode from full to low_latency.

Also, define a global array and variable that used to save preempt mode name and size.

Yeah, let's not rename this for giggles. Regular preemption is a fully preemptible kernel model. No need to invent new names for it.