[2/2] sched/preempt: Avoid updating for duplicate preempt mode

Message ID 20240112091916.696185-2-songshuaishuai@tinylab.org
State New
Headers
Series [1/2] sched/preempt: Remove preceding unnecessary enables in __sched_dynamic_update |

Commit Message

Song Shuai Jan. 12, 2024, 9:19 a.m. UTC
  When echoing the current preempt mode to /sys/kernel/debug/sched/preempt,
we don't have to update SC or SK in the sched_dynamic_update() function.

Stop it at the sched_dynamic_write() function.

Signed-off-by: Song Shuai <songshuaishuai@tinylab.org>
---
 kernel/sched/debug.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
  

Patch

diff --git a/kernel/sched/debug.c b/kernel/sched/debug.c
index 4580a450700e..dafcfdfae23d 100644
--- a/kernel/sched/debug.c
+++ b/kernel/sched/debug.c
@@ -235,7 +235,8 @@  static ssize_t sched_dynamic_write(struct file *filp, const char __user *ubuf,
 	if (mode < 0)
 		return mode;
 
-	sched_dynamic_update(mode);
+	if (preempt_dynamic_mode != mode)
+		sched_dynamic_update(mode);
 
 	*ppos += cnt;