CONFIG_PREEMPT 和 CONFIG_PREEMPT_VOLUNTARY的区别
来源:互联网 发布:尼尔森数据网 编辑:程序博客网 时间:2024/06/07 10:17
在kernel/kernel/Kconfig.preempt中定义了两种抢占策略,PREEMPT_VOLUNTARY和PREEMPT
其中PREEMPT_VOLUNTARY 适用于有桌面的环境,而PREEMPT 则可以用于桌面或者嵌入式,其调度延迟是毫秒级别的。详细说明如下:
config PREEMPT_VOLUNTARY
bool "Voluntary Kernel Preemption (Desktop)"
help
This option reduces the latency of the kernel by adding more
"explicit preemption points" to the kernel code. These new
preemption points have been selected to reduce the maximum
latency of rescheduling, providing faster application reactions,
at the cost of slightly lower throughput.
This allows reaction to interactive events by allowing a
low priority process to voluntarily preempt itself even if it
is in kernel mode executing a system call. This allows
applications to run more 'smoothly' even when the system is
under load.
Select this if you are building a kernel for a desktop system.
config PREEMPT
bool "Preemptible Kernel (Low-Latency Desktop)"
select PREEMPT_COUNT
select UNINLINE_SPIN_UNLOCK if !ARCH_INLINE_SPIN_UNLOCK
help
This option reduces the latency of the kernel by making
all kernel code (that is not executing in a critical section)
preemptible. This allows reaction to interactive events by
permitting a low priority process to be preempted involuntarily
even if it is in kernel mode executing a system call and would
otherwise not be about to reach a natural preemption point.
This allows applications to run more 'smoothly' even when the
system is under load, at the cost of slightly lower throughput
and a slight runtime overhead to kernel code.
Select this if you are building a kernel for a desktop or
embedded system with latency requirements in the milliseconds
从code中看主要影响下面这两个函数
static inline void crypto_yield(u32 flags)
{
#if !defined(CONFIG_PREEMPT) || defined(CONFIG_PREEMPT_VOLUNTARY)
if (flags & CRYPTO_TFM_REQ_MAY_SLEEP)
cond_resched();
#endif
}
在crypto_yield 中如果定义了CONFIG_PREEMPT_VOLUNTARY 就调度,而CONFIG_PREEMPT 则是不调度的,继续留在原来的task中
和
#ifdef CONFIG_PREEMPT_VOLUNTARY
extern int _cond_resched(void);
# define might_resched() _cond_resched()
#else
# define might_resched() do { } while (0)
#endif
如果code中调用might_resched的话,就发生调度。
从code中看CONFIG_PREEMPT_VOLUNTARY 就是会比 CONFIG_PREEMPT 的调度延迟少一点。
其中PREEMPT_VOLUNTARY 适用于有桌面的环境,而PREEMPT 则可以用于桌面或者嵌入式,其调度延迟是毫秒级别的。详细说明如下:
config PREEMPT_VOLUNTARY
bool "Voluntary Kernel Preemption (Desktop)"
help
This option reduces the latency of the kernel by adding more
"explicit preemption points" to the kernel code. These new
preemption points have been selected to reduce the maximum
latency of rescheduling, providing faster application reactions,
at the cost of slightly lower throughput.
This allows reaction to interactive events by allowing a
low priority process to voluntarily preempt itself even if it
is in kernel mode executing a system call. This allows
applications to run more 'smoothly' even when the system is
under load.
Select this if you are building a kernel for a desktop system.
config PREEMPT
bool "Preemptible Kernel (Low-Latency Desktop)"
select PREEMPT_COUNT
select UNINLINE_SPIN_UNLOCK if !ARCH_INLINE_SPIN_UNLOCK
help
This option reduces the latency of the kernel by making
all kernel code (that is not executing in a critical section)
preemptible. This allows reaction to interactive events by
permitting a low priority process to be preempted involuntarily
even if it is in kernel mode executing a system call and would
otherwise not be about to reach a natural preemption point.
This allows applications to run more 'smoothly' even when the
system is under load, at the cost of slightly lower throughput
and a slight runtime overhead to kernel code.
Select this if you are building a kernel for a desktop or
embedded system with latency requirements in the milliseconds
从code中看主要影响下面这两个函数
static inline void crypto_yield(u32 flags)
{
#if !defined(CONFIG_PREEMPT) || defined(CONFIG_PREEMPT_VOLUNTARY)
if (flags & CRYPTO_TFM_REQ_MAY_SLEEP)
cond_resched();
#endif
}
在crypto_yield 中如果定义了CONFIG_PREEMPT_VOLUNTARY 就调度,而CONFIG_PREEMPT 则是不调度的,继续留在原来的task中
和
#ifdef CONFIG_PREEMPT_VOLUNTARY
extern int _cond_resched(void);
# define might_resched() _cond_resched()
#else
# define might_resched() do { } while (0)
#endif
如果code中调用might_resched的话,就发生调度。
从code中看CONFIG_PREEMPT_VOLUNTARY 就是会比 CONFIG_PREEMPT 的调度延迟少一点。
0 0
- CONFIG_PREEMPT 和 CONFIG_PREEMPT_VOLUNTARY的区别
- 和和的区别
- & 和 &&、|和||的区别:
- &和&&、|和||的区别
- &&和&,||和|的区别
- &和&&、|和||的区别
- &和&&、|和||的区别
- ../和./和/的区别
- &和&&,|和||的区别
- "&"和"&&"、"|"和"||"的区别
- &和&& |和||的区别
- &和&&的区别 |和||的区别
- &&和&的区别,||和|的区别
- &和&&的区别以及|和||的区别
- &&和&的区别? | | 和|的区别?
- &和&&的区别,|和||的区别
- &和&&的区别及!和~区别
- '&'和'*' (C++)的区别
- python 打包
- 有return的情况下try catch finally的执行顺序(最有说服力的总结)
- ajax实时更新数据
- 解决Clion toolchain 问题
- 三种典型的博弈论问题(巴什博奕、威佐夫博奕、尼姆博奕)
- CONFIG_PREEMPT 和 CONFIG_PREEMPT_VOLUNTARY的区别
- HttpServletRequest 常用方法讲解
- 【C++学习笔记】关于预处理器的几个问题
- 自定义View
- Ubuntu 14.04 安装mysql 5.7
- 使用adb指令查看App私有数据库数据
- java读取Excel中的数据
- android RippleDrawable讲解
- 剑指Offer—— 跳台阶