Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Scheduling entities were introduced in order to implement group scheduling, so that CFS (or RT scheduler) will provide fair CPU time for individual tasks but also fair CPU time to groups of tasks. Scheduling entity may be either a task or group of tasks.</p> <p><code>struct list_head</code> is just Linux way to implement linked list. In the code you posted fields <code>group_node</code> and <code>run_list</code> allow to create lists of <code>struct sched_entity</code> and <code>struct sched_rt_entity</code>. More information can be found <a href="http://isis.poly.edu/kulesh/stuff/src/klist/" rel="nofollow">here</a>.</p> <p>Using these <code>list_heads</code> scheduling entities are stored in certain scheduler related data structures, for example <code>cfs_rq.cfs_tasks</code> if an entity is a task enqueued using <a href="http://lxr.free-electrons.com/source/kernel/sched/fair.c#L780" rel="nofollow"><code>account_entity_enqueue()</code></a>.</p> <p>Always up to date documentation of Linux kernel can be found within its sources. In this case you should check <a href="http://www.mjmwired.net/kernel/Documentation/scheduler" rel="nofollow">this</a> directory and especially <a href="http://www.mjmwired.net/kernel/Documentation/scheduler/sched-design-CFS.txt" rel="nofollow">this</a> file which describes CFS. There is also <a href="http://www.mjmwired.net/kernel/Documentation/cgroups/cgroups.txt" rel="nofollow">an explanation</a> of task groups.</p> <p><strong>EDIT:</strong> <code>task_struct</code> contains a field <code>se</code> of type <code>struct sched_entity</code>. Then, having an address to a <code>sched_entity</code> object using <code>container_of</code> macro it is possible to retrieve an address to the <code>task_struct</code> object, see <a href="http://lxr.free-electrons.com/source/kernel/sched/fair.c#L256" rel="nofollow"><code>task_of()</code></a>. (address of <code>sched_entity</code> object - offset of <code>se</code> in <code>task_struct</code> = address of <code>task_struct</code> object) This is quite common trick used also in the implementation of lists I mentioned earlier in this answer.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload