/* Real-Time classes' related field in a runqueue: */ struct rt_rq { struct rt_prio_array active; unsigned int rt_nr_running; unsigned int rr_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 int rt_nr_migratory; unsigned int rt_nr_total; int overloaded; struct plist_head pushable_tasks; #endif /* CONFIG_SMP */ int rt_queued; 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 int rt_nr_boosted; struct rq *rq; struct task_group *tg; #endif };
时间: 2024-04-07 21:28:27 浏览: 22
这是 Linux 内核中实时调度器相关的代码,定义了一个名为 `rt_rq` 的结构体类型,表示实时进程在运行队列中的相关信息。该结构体包含了以下字段:
- `active`:实时进程在运行队列中的优先级数组;
- `rt_nr_running`:当前实时进程的数量;
- `rr_nr_running`:当前时间片轮转进程的数量;
- `highest_prio`:最高实时进程的优先级;
- `rt_nr_migratory`:正在迁移的实时进程数量;
- `rt_nr_total`:实时进程总数;
- `overloaded`:是否超载;
- `pushable_tasks`:可移动的任务列表;
- `rt_queued`:正在排队的实时进程数量;
- `rt_throttled`:正在被限制的实时进程数量;
- `rt_time`:实时进程的运行时间;
- `rt_runtime`:实时进程的运行总时间;
- `rt_runtime_lock`:实时进程的运行时间锁;
- `rt_nr_boosted`:已提升优先级的实时进程数量;
- `rq`:实时进程所在的运行队列;
- `tg`:实时进程所在的任务组。
相关问题
所以,rt_rq 数据结构是?
`rt_rq` 是 Linux 实时调度器中的数据结构,用于维护实时进程队列。在 Linux 5.15.95 中,`rt_rq` 的定义如下:
```
struct rt_rq {
struct rq *rq; /* pointer to the runqueue we belong to */
struct rt_bandwidth rt_bandwidth;
u64 rt_time;
u64 rt_runtime_expires;
struct list_head rt_runtime_queue;
struct task_struct *rt_curr, *rt_throttled;
unsigned long rt_nr_running;
int rt_throttle;
struct rt_prio_array active;
};
```
其中,`rq` 是指向运行队列(runqueue)的指针,`rt_bandwidth` 是实时带宽控制器的数据结构,用于限制实时进程的 CPU 使用时间。`rt_time` 是实时进程队列中的总 CPU 时间,`rt_runtime_expires` 表示实时进程队列中下一个进程的截止时间,`rt_runtime_queue` 是一个双向链表,用于存储所有在实时进程队列中的进程。`rt_curr` 是当前正在运行的实时进程,`rt_throttled` 是被限制了 CPU 使用时间的实时进程。`rt_nr_running` 表示实时进程队列中的进程数,`rt_throttle` 表示实时调度器是否处于限制 CPU 使用时间的状态。
`active` 是一个优先级数组,用于存储实时进程队列中正在运行的进程。`active` 数组中存储的是优先级最高的实时进程队列,而 `struct rt_prio_array` 是用于存储不同优先级的实时进程队列的数组类型。
总之,`rt_rq` 是用于维护实时进程队列的数据结构,包含实时带宽控制器、实时进程队列、正在运行的实时进程以及其他相关信息。
linux 5.15 中 rt_rq 数据结构
rt_rq 是 Linux 内核实时调度器中的一个数据结构,用于维护实时进程队列。rt_rq 结构体定义在 include/linux/sched/rt.h 中,其定义如下:
```
struct rt_rq {
struct rt_bandwidth rt_bandwidth;
struct list_head rt_runtime_queue;
unsigned long rt_nr_running;
u64 rt_time;
u64 rt_runtime_expires;
struct task_struct *rt_curr, *rt_throttled;
struct rq *rq;
int overloaded;
};
```
其中,rt_bandwidth 是实时带宽控制器的数据结构,用于限制实时进程的 CPU 使用时间。rt_runtime_queue 是一个双向链表,用于存储所有在实时进程队列中的进程。rt_nr_running 表示实时进程队列中的进程数。rt_time 是实时进程队列中的总 CPU 时间。rt_runtime_expires 表示实时进程队列中下一个进程的截止时间。rt_curr 是当前正在运行的实时进程,rt_throttled 是被限制了 CPU 使用时间的实时进程。rq 是指向运行 rt_rq 的 CPU 的 runqueue 的指针。overloaded 表示实时进程队列是否过载。
总之,rt_rq 数据结构是 Linux 实时调度器中一个重要的数据结构,用于维护实时进程队列。
相关推荐
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)