Gregory Nutt <spudan...@gmail.com> 于2023年4月23日周日 04:24写道:

> I am not sure what this mean.  But if you mean calling
> enter_critical_secion() in sched_lock(), then it is a very bad idea  You
> should not do that.  enter_critical_section() disables interrupts on all
> CPUs and this must never happen when disabling preemption.
>
> In the SMP case, that involves and coordiation with all other CPUs with
> inter-CPU messages in order to assure that interrupts are disabled on
> all CPUs.  That is terrible thing and must not happen.

You happen to understand the opposite.

Well, I mean calling sched_lock() in enter_critical_secion()
This way, many places that simultaneously call sched_lock() and
enter_critical_secion() can be replaced with enter_critical_secion().

This simplifies and reduces the use of sched_lock(), laying the
foundation for subsequent optimization.

And as you mentioned earlier, the cost of sched_lock() is minimal.

BR!

Reply via email to