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

Dawei Li daweilics at gmail.com
Fri Dec 8 13:21:34 EST 2023

Hi Valdis,

Thanks for getting back to me!
I should've looked into newer versions. (Was looking at 2.6.34 because the
latest book I have on linux kernel, Linux
Kernel Development, 3rd Edition by Robert Love, is based on that version.)

I do have the same question for the latest version.
the scheduler_tick() is calling curr->sched_class->task_tick(rq, curr, 0);
This is calling entity_tick(),
and then resched_curr(),

As the comment says, resched_curr() is still just setting the need_resched
flag on a uniprocessor.
It is not calling the schedule() function.
When/how is the schedule() function actually called?

Appreciate any explanation/guidance on this!

On Sat, Dec 9, 2023 at 1:45 AM Valdis Klētnieks <valdis.kletnieks at vt.edu>

> On Sat, 09 Dec 2023 00:16:32 +0800, Dawei Li said:
> > Greetings!
> > (Although I am using the 2.6.34 version, I believe the question is
> generally
> > applicable to any kernel version.)
> That is, in general, a bad assumption when you are looking at kernel
> versions
> old enough that they count as digital archaeology....
> [/usr/src/linux-next] git show v2.6.34
> tag v2.6.34
> Tagger: Linus Torvalds <torvalds at linux-foundation.org>
> Date:   Sun May 16 14:17:44 2010 -0700
> [/usr/src/linux-next] git diff --shortstat  v2.6.34..next-20231205
>  96965 files changed, 32056985 insertions(+), 7606202 deletions(-)
> Given that next-20231205 has just over 33 million lines of code, we're well
> into territory where there's a vanishing small percentage of code still
> remaining unchanged from 2010.
> And yes, that means that even basic functions schedule() and friends have
> been
> reworked in he past decade and a half....
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20231209/b73209d0/attachment.html>

More information about the Kernelnewbies mailing list