gpt4 book ai didi

linux - 了解 rt_rq(real time runqueue) 内核中数据成员的使用

转载 作者:IT王子 更新时间:2023-10-29 01:19:51 28 4
gpt4 key购买 nike

以下为v3.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
};

我已经理解了一些数据成员代表什么,但我不完全确定以下数据成员:

a) rt_nr_migratory :(我认为)它是一个计数器,用于计算可以将多少任务推送到其他 cpu

b) pushable_tasks 是任务列表,如果它们没有任何可运行的任务,可以将其推送到其他运行队列。

如果我对以上条目有误,请纠正我。

c) rt_throttled, rt_time, rt_runtime, rt_nr_total, rt_nr_boosted :我不明白这个有什么用。

另外,为什么 struct rq *rq; 仅在存在组调度时才需要。我的意思是它的意义是什么。

最佳答案

这是一个很难回答的问题,部分原因是它实际上同时包含了六个复杂的问题。因此,为了帮助您理解其中的每一个部分,我查看了每个字段的添加时间。阅读提交消息以及可能引入每个字段的补丁应该会让您更接近于理解它们存在的原因。

rt_nr_migratory在提交中添加 sched: add RT-balance cpu-weight .

pushable_tasks在提交中添加 sched: create "pushable_tasks" list to limit pushing to one attempt .

rt_throttledrt_time在提交中添加 sched: rt time limit .

rt_runtime在提交中添加 sched: rt-group: smp balancing .

rt_nr_total在提交中添加 sched_rt: Fix overload bug on rt group scheduling .

rt_nr_boosted在提交中添加 sched: rt-group: deal with PI . (我相信这里的“PI”意味着“优先级反转”。)

rq在提交中添加 sched: rt group scheduling .


我用了git blame找出引入每一行的时间,但在这种情况下非常复杂,因为自从完成所有这些工作以来,调度程序源代码经历了两次重大重组。所以当我使用 git blame sched.h ,它告诉我整个结构是一次性添加的,但它命名的提交实际上是在结构移出 sched.c 时。 .然后我用了 git blame <commit>~ -- sched.c查看 sched.c 在更改之前的样子。最后,对于我认为可能重要的每个提交,我使用 git show <commit> 进行了仔细检查。 .

关于linux - 了解 rt_rq(real time runqueue) 内核中数据成员的使用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13080766/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com