简体   繁体   English

Linux Kernel文档中的以下句子是什么意思?

[英]What is meant by the following sentence in the Linux Kernel documentation?

In the Linux kernel source code, the file Documentation/scheduler/sched-arch.txt contains the following lines. 在Linux内核源代码中,文件Documentation/scheduler/sched-arch.txt包含以下行。

Your cpu_idle routines need to obey the following rules: 您的cpu_idle例程需要遵守以下规则:

Preempt should now disabled over idle routines. 现在应该通过空闲例程禁用抢占。 Should only be enabled to call schedule() then disabled again. 应该只启用调用schedule()然后再次禁用。

I am relatively new to the Linux kernel world, so I can think of three possible interpretations for the first line for implementors of a cpu_idle routine. 我对Linux内核世界比较cpu_idle ,所以我可以想到对cpu_idle例程的实现者的第一行有三种可能的解释。

  1. We should assume that preemption is disabled. 我们应该假设抢占被禁用。
  2. We should verify that preemption is disabled 我们应该验证抢占是否被禁用
  3. We should ensure that preemption is disabled. 我们应该确保禁用抢占。

Does anyone with more kernel experience know the correct interpretation? 有更多内核经验的人是否知道正确的解释?

Yikes. 让人惊讶。 If you're adding support for a new platform, please update that comment while you're at it. 如果您要添加对新平台的支持,请在访问时更新该评论。

I haven't done Linux kernel development in a long time, but as far as I can tell, it should say "Preemption is disabled [by the kernel] while running your cpu_idle routine. You should enable it only to call schedule(), and then disable it again immediately." 我很久没有完成Linux内核开发了,但据我所知,它应该说“在运行你的cpu_idle例程时,[内核]禁用抢占。你应该只启用它调用schedule(),然后立即再次禁用它。“

For example, in the PPC idle.c, the while loop ends with: 例如,在PPC idle.c中,while循环以以下结尾:

preempt_enable_no_resched();
schedule();
preempt_disable();

and doesn't touch preemption otherwise. 并且不会触及先发制人。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM