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

Dawei Li <[email protected]>
Newsgroups org.kernelnewbies.kernelnewbies
Message-ID <CAG5MgCpmkwwSTdWTa8AYnktuAeMzGcYtZMkZNx151K30eOxiUA@mail.gmail.com>
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!

_______________________________________________
Kernelnewbies mailing list
[email protected]
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.