Chinaunix首页 | 论坛 | 博客
  • 博客访问: 437388
  • 博文数量: 123
  • 博客积分: 2686
  • 博客等级: 少校
  • 技术积分: 1349
  • 用 户 组: 普通用户
  • 注册时间: 2009-12-23 22:11
文章分类
文章存档

2012年(3)

2011年(10)

2010年(100)

2009年(10)

我的朋友

分类: LINUX

2010-09-21 18:48:49

struct sched_entity is embedded in struct task_struct.
Process use this data structure to account the running time for CFS scheduling.

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


load: specifies a weight for each schedule entity that contribute to total load of run queue. Computing load is an important work of scheduler, because the task of virtual run time required by CFS will ultimately depend on it.

run_node: is a standard tree element that allows the entity to be stored in red-black tree.

on_rq: denotes whether the entity is on run queue or not.

sum_exec_runtime: when a process is running, the consumed time need to be recorded.

vruntime: the amount of time that elapse on virtual clock is accounted in vruntime.
CFS scheduler use vruntime to account how long a process has been running and how long it ought to run.The function update_curr() defined in sched_fair.c manage this accounting.


阅读(2465) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~