CFS调度程序:如何知道分配给调度的任务
我在sched_fair.c里面,我想记录几件事情,但我需要知道哪些任务(pid)与我看到的每个sched_entity相关联..在struct sched_entity的定义中,我没有看到任何对父结构体的引用(task_struct)
这是sched_entity的代码:
struct sched_entity {
struct load_weight load; /* for load-balancing */
struct rb_node run_node;
struct list_head group_node;
unsigned int on_rq;
u64 exec_start;
u64 sum_exec_runtime;
u64 vruntime;
u64 prev_sum_exec_runtime;
u64 nr_migrations;
#ifdef CONFIG_SCHEDSTATS
struct sched_statistics statistics;
#endif
#ifdef CONFIG_FAIR_GROUP_SCHED
struct sched_entity *parent;
/* rq on which this entity is (to be) queued: */
struct cfs_rq *cfs_rq;
/* rq "owned" by this entity/group: */
struct cfs_rq *my_q;
#endif
};
鉴于sched_entity * se:
struct task_struct * p = task_of(se);
给你包含任务结构..
链接地址: http://www.djcxy.com/p/14847.html上一篇: CFS scheduler: how to know which task is assigned to a sched