Understanding data usage in the rt_rq kernel (realtime runqueue)

Below is the structure of the real-time execution queue in version 3.5.4.

struct rt_rq { struct rt_prio_array active; unsigned int rt_nr_running; #if defined CONFIG_SMP || defined CONFIG_RT_GROUP_SCHED struct { int curr; /* highest queued rt task prio */ #ifdef CONFIG_SMP int next; /* next highest */ #endif } highest_prio; #endif #ifdef CONFIG_SMP unsigned long rt_nr_migratory; unsigned long rt_nr_total; int overloaded; struct plist_head pushable_tasks; #endif int rt_throttled; u64 rt_time; u64 rt_runtime; /* Nests inside the rq lock: */ raw_spinlock_t rt_runtime_lock; #ifdef CONFIG_RT_GROUP_SCHED unsigned long rt_nr_boosted; struct rq *rq; struct list_head leaf_rt_rq_list; struct task_group *tg; #endif }; 

I realized that there are some data members, but I'm not quite sure about the following data members:

a) rt_nr_migratory : (I think) this is a counter to count how many tasks can be transferred to another processor

b) pushable_tasks is a list of tasks that can be moved to other execution queues if they have nothing to run.

Please correct me if I am mistaken regarding the above entries.

c) rt_throttled , rt_time , rt_runtime , rt_nr_total , rt_nr_boosted : I do not understand what this means.

Also why struct rq *rq; only required when group planning exists. I mean, what is its significance.

+4
source share
1 answer

This is a difficult question, partly because it really is half a dozen complex questions right away. Therefore, to help you understand each of these parts, I looked at when each of these fields was added. Reading the commit message, and possibly the patch in which each field was entered, should be much closer to understanding why they are there.

rt_nr_migratory been added to commit sched: add RT balance weight balance .

pushable_tasks been added to commit sched: create a list of "pushable_tasks" to limit the click of one attempt .

rt_throttled and rt_time were added to commit sched: rt time limit .

rt_runtime been added to commit sched: rt-group: smp balancing .

rt_nr_total been added to commit sched_rt: Fix an overload error when planning rt groups .

rt_nr_boosted been added to commit sched: rt-group: handle PI . (I believe that "PI" here means "priority inversion.")

rq been added to commit sched: rt group scheduling .


I used git blame to find out when each line was introduced, but in this case it was rather complicated because the source code of the scheduler went through two major reorganizations, since all this work was done. Therefore, when I used git blame sched.h , he told me that the whole structure was added right away, but the commit that he called was actually when the structure was moved from sched.c . Then I used git blame <commit>~ -- sched.c to see what sched.c looks like before this change. Finally, for every commit that I thought might matter, I double-checked with git show <commit> .

+5
source

Source: https://habr.com/ru/post/1442237/


All Articles