Re: [RFC PATCH 2/3] docs: scheduler: Add scheduler overview documentation
From: Peter Zijlstra
Date: Wed Apr 01 2020 - 08:26:37 EST
On Wed, Apr 01, 2020 at 01:47:04PM +0200, Daniel Bristot de Oliveira wrote:
> On 4/1/20 12:35 PM, Peter Zijlstra wrote:
> >> +Scheduler State Transition
> >> +==========================
> >> +
> >> +A very high level scheduler state transition flow with a few states can be
> >> +depicted as follows.
> >> +
> >> +.. kernel-render:: DOT
> >> + :alt: DOT digraph of Scheduler state transition
> >> + :caption: Scheduler state transition
> >> +
> >> + digraph sched_transition {
> >> + node [shape = point, label="exisiting task\n calls fork()"]; fork
> >> + node [shape = box, label="TASK_NEW\n(Ready to run)"] tsk_new;
> >> + node [shape = box, label="TASK_RUNNING\n(Ready to run)"] tsk_ready_run;
> >> + node [shape = box, label="TASK_RUNNING\n(Running)"] tsk_running;
> >> + node [shape = box, label="TASK_DEAD\nEXIT_ZOMBIE"] exit_zombie;
> >> + node [shape = box, label="TASK_INTERRUPTIBLE\nTASK_UNINTERRUPTIBLE\nTASK_WAKEKILL"] tsk_int;
> >> + fork -> tsk_new [ label = "task\nforks" ];
> >> + tsk_new -> tsk_ready_run;
> >> + tsk_ready_run -> tsk_running [ label = "schedule() calls context_switch()" ];
> >> + tsk_running -> tsk_ready_run [ label = "task is pre-empted" ];
> >> + subgraph int {
> >> + tsk_running -> tsk_int [ label = "task needs to wait for event" ];
> >> + tsk_int -> tsk_ready_run [ label = "event occurred" ];
> >> + }
> >> + tsk_int -> exit_zombie [ label = "task exits via do_exit()" ];
> >> + }
> > And that is a prime example of why I hates RST, it pretty much mandates
> > you view this with something other than a text editor.
>
> The good thing about the dot format is that we can convert it to many other
> formats, including text:
Oh, I know and love dot files, I generate them occasionally. But they
stink as end-result, which is what it is here.
If you can't read a document (or worse comment) in a code editor it's
broken (and yes, I know some subsystems have a different opinion here).