sched: Clarify PREEMPT is full preemption model

余华兵 posted 1 patch 3 weeks ago
kernel/Kconfig.preempt | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
sched: Clarify PREEMPT is full preemption model
Posted by 余华兵 3 weeks ago
The configuration file "kernel/Kconfig. preempt" says that PREEMPT_RT is 
fully preemptible, but from the function preempt_model_full() it can be 
seen that PREEMPT is full preemption model.
--------------------------
kernel/Kconfig.preempt
config PREEMPT
        bool "Preemptible Kernel (Low-Latency Desktop)"

config PREEMPT_RT
        bool "Fully Preemptible Kernel (Real-Time)"

include/linux/preempt.h
static inline bool preempt_model_full(void)
{
        return IS_ENABLED(CONFIG_PREEMPT);
}
--------------------------

I suggest that the configuration file "kernel/Kconfig. preempt" should be 
consistent with the function preempt_model_full(). Modify the file 
"kernel/Kconfig.preempt" as follows.
------------------
config PREEMPT
        bool "Fully Preemptible Kernel (Low-Latency Desktop)"

config PREEMPT_RT
        bool "Real-time Kernel"
------------------
From f49c37767b08181e30af40121d5a000b6e2b4ffa Mon Sep 17 00:00:00 2001
From: Yu Huabing <yhb@ruijie.com.cn>
Date: Wed, 15 Jan 2025 16:15:25 +0800
Subject: [PATCH] sched: Clarify PREEMPT is full preemption model

The configuration file "kernel/Kconfig. preempt" says that PREEMPT_RT is 
fully preemptible, but from the function preempt_model_full() it can be 
seen that PREEMPT is full preemption model.
--------------------------
kernel/Kconfig.preempt
config PREEMPT
	bool "Preemptible Kernel (Low-Latency Desktop)"

config PREEMPT_RT
	bool "Fully Preemptible Kernel (Real-Time)"

include/linux/preempt.h
static inline bool preempt_model_full(void)
{
	return IS_ENABLED(CONFIG_PREEMPT);
}
--------------------------

I suggest that the configuration file "kernel/Kconfig. preempt" should be 
consistent with the function preempt_model_full(). Modify the file 
"kernel/Kconfig.preempt" as follows.
------------------
config PREEMPT
	bool "Fully Preemptible Kernel (Low-Latency Desktop)"

config PREEMPT_RT
	bool "Real-time Kernel"
------------------

Signed-off-by: Yu Huabing <yhb@ruijie.com.cn>
---
 kernel/Kconfig.preempt | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/Kconfig.preempt b/kernel/Kconfig.preempt
index 54ea59ff8fbe..595e0c584958 100644
--- a/kernel/Kconfig.preempt
+++ b/kernel/Kconfig.preempt
@@ -54,7 +54,7 @@ config PREEMPT_VOLUNTARY
 	  Select this if you are building a kernel for a desktop system.
 
 config PREEMPT
-	bool "Preemptible Kernel (Low-Latency Desktop)"
+	bool "Fully Preemptible Kernel (Low-Latency Desktop)"
 	depends on !ARCH_NO_PREEMPT
 	select PREEMPT_BUILD if !PREEMPT_DYNAMIC
 	help
@@ -87,7 +87,7 @@ config PREEMPT_LAZY
 endchoice
 
 config PREEMPT_RT
-	bool "Fully Preemptible Kernel (Real-Time)"
+	bool "Real-time Kernel"
 	depends on EXPERT && ARCH_SUPPORTS_RT && !COMPILE_TEST
 	select PREEMPTION
 	help
-- 
2.43.0

Re: sched: Clarify PREEMPT is full preemption model
Posted by Shrikanth Hegde 2 weeks, 6 days ago
Please use plaintext for sending mail containing patches.
Not able to see the patch on my mail client.  Also the text is not formatted.

https://docs.kernel.org/process/submitting-patches.html#no-mime-no-links-no-compression-no-attachments-just-plain-text


On 1/15/25 15:24, 余华兵 wrote:
> The configuration file "kernel/Kconfig. preempt" says that PREEMPT_RT is 
> fully preemptible, but from the function preempt_model_full() it can be 
> seen that PREEMPT is full preemption model. -------------------------- 
> kernel/Kconfig.preempt config PREEMPT         bool "Preemptible Kernel 
> (Low-Latency Desktop)" config PREEMPT_RT         bool "Fully Preemptible 
> Kernel (Real-Time)" include/linux/preempt.h static inline bool 
> preempt_model_full(void) {         return IS_ENABLED(CONFIG_PREEMPT); } 
> -------------------------- 

On Preempt_RT kernel, the spinlocks are sleeping locks and irqs can run as threaded.
So even those can be preempted if necessary. That is not true with preempt=full alone.

I suggest that the configuration file
> "kernel/Kconfig. preempt" should be consistent with the function 
> preempt_model_full(). Modify the file "kernel/Kconfig.preempt" as 
> follows. ------------------ config PREEMPT         bool "Fully 
> Preemptible Kernel (Low-Latency Desktop)" config PREEMPT_RT         bool 
> "Real-time Kernel" ------------------