Aman Deep Gautam
Aman Deep Gautam

Reputation: 8747

meaning of data members in sched_rt_entity

The following is the code for the entity class for RT policy in linux scheduling.

struct sched_rt_entity {
     struct list_head run_list;
     unsigned long timeout;
     unsigned int time_slice;

     struct sched_rt_entity *back;
     #ifdef CONFIG_RT_GROUP_SCHED
     struct sched_rt_entity  *parent;
     /* rq on which this entity is (to be) queued: */
     struct rt_rq            *rt_rq;
     /* rq "owned" by this entity/group: */
     struct rt_rq            *my_q;
     #endif
};

What is data member back required when the list is already implemented.

I also do not understand how the group scheduling policy is implemented, particularly why there is a need of my_rq and rt_rq and who will parent point to.

Also what is the meaning of timeout data member.

P.S.: I have lots and lots of such question, Can anyone suggest a good read.

Upvotes: 0

Views: 1459

Answers (1)

CL.
CL.

Reputation: 180060

When using group scheduling, there is not a single queue, but a tree of groups and their queues. For example, when two users have a scheduling group each, the overall group/queue might allocate 50 % CPU to each user's group, while all the users' programs are in their group's queue and compete for that 50 %. For a more detailed explanation of how the multiple queues work, see CFS group scheduling.

parent points to the entity one level up in the tree; rt_rq is the queue on which this entity runs, while my_q is the queue on which this entity's children run.

The back field is used as temporary storage in the dequeue_rt_stack() function to implement a stack, where we have a pointer to the lowest entity, but want to remove them beginning from the top-level one.

timeout is increased by the watchdog timer and used to check that the task does not hog the CPU for longer than RLIMIT_RTTIME.


There are no books about recent kernel changes. Use the source, Luke.

Upvotes: 2

Related Questions