我知道如果我们有 task_struct,我们可以得到包含的 sched_entity,因为它是任务结构中的一个字段。但是我们可以在给定 shed_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
};
似乎没有地方可以得到task_struct。我的最终目标是使用这个 shed_entity 获得包含任务的任务 group_leader 的 sched_entity :>