when/how is the schedule() function actually called?

Dawei Li daweilics at gmail.com
Fri Dec 8 11:16:32 EST 2023


Greetings!

I am reading several resources regarding the linux kernel scheduling
(in kernel 2.6.34).
There seems to be the periodic scheduler (tick_periodic()), which
invokes the scheduler_tick() function, then the entity_tick()
function, and then the resched_task() function. However, eventually,
the resched_task() function doesn't invoke the schedule() function; it
only invokes the set_tsk_need_resched() function. So, it is only
setting the need_resched flag.
My question is, when/how is the schedule() function actually called?
Also, I notice that at many locations in the code, when there is the
need to do a scheduling, the code is just setting the need_resched
flag. Same question: when/how is the schedule() function actually
called?
(Although I am using the 2.6.34 version, I believe the question is generally
applicable to any kernel version.)

Not sure if this list is still active. Appreciate any response.
Thanks!



More information about the Kernelnewbies mailing list