CFS scheduler: how to know which task is assigned to a sched

I'm inside sched_fair.c and I'd like to log a few things.. but I need to know which task (pid) is associated with each sched_entity that I see.. in the definition on struct sched_entity I don't see any reference to the parent struct (task_struct)

this is the code for 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
};

Given sched_entity *se :

struct task_struct *p = task_of(se);

gives you the containing task struct..

链接地址: http://www.djcxy.com/p/14848.html

上一篇: 了解多级反馈队列调度

下一篇: CFS调度程序:如何知道分配给调度的任务