when/how is the schedule() function actually called?
Billie Alsup (balsup)
balsup at cisco.com
Thu Dec 14 12:13:37 EST 2023
> But I don't see any code that is calling the schedule or __schedule function.
I think with a little investigation, you will be able to figure it out. For example, arch/x86/entry/common.c
in function do_syscall_64 calls syscall_entr_from_user_mode and syscall_exit_to_user_mode. I could guess
we eventually reach exit_to_user_mode_loop, which will conditionally call schedule() which calls __schedule
(although I didn't investigate this chain, so am just guessing).
I'm a newbie to this stuff as well, but it is not too difficult to follow this. I would guess there are
IDEs available that can help you with diagramming the flow if you don't want to manually find things
one layer at a time. The Documentation folder also has a lot of good information. For example,
Documentation/trace/histogram.rst shows some backtraces with __schedule, and you can see
examples of how it is called from do_syscall_64 and ret_from_fork. Other traces are available in
Documentation/trace/ftrace.rst
More information about the Kernelnewbies
mailing list