2012-05-31 81 views
0

我在sched_fair.c里面,我想记录几件事情,但我需要知道哪些任务(pid)与每个sched_entity相关联,我看到..在struct sched_entity的定义上我不'吨看到母体结构的任何参考(的task_struct)CFS调度程序:如何知道将哪个任务分配给sched_entity?

这是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 
}; 

回答

3

鉴于 sched_entity * SE:

结构的task_struct * p = task_of(SE);

给你包含任务结构..

相关问题