2012-05-31 57 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);

給你包含任務結構..

相關問題