Chinaunix首页 | 论坛 | 博客
  • 博客访问: 32933
  • 博文数量: 5
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 71
  • 用 户 组: 普通用户
  • 注册时间: 2011-03-02 21:05
文章分类
文章存档

2014年(5)

我的朋友

分类: LINUX

2014-05-22 17:18:06


点击(此处)折叠或打开

  1. struct sched_avg {
  2.     /*
  3.      * These sums represent an infinite geometric series and so are bound
  4.      * above by 1024/(1-y). Thus we only need a u32 to store them for all
  5.      * choices of y < 1-2^(-32)*1024.
  6.      */
  7.     u32 runnable_avg_sum, runnable_avg_period;  /* 前一个:调度实体累计负载均衡值(不包括未进入运行队列期间的负载均衡值);后一个:调度实体累计负载均衡值 */
  8.     u64 last_runnable_update;  /* 最近一次更新负载均衡值的时间,用ns表示 */
  9.     s64 decay_count;  /* 记录上次该调度实体离开cfs队列的时间,以ms为单位 */
  10.     unsigned long load_avg_contrib;  /* 该调度实体对它所属的CFS_RQ队列的负载均衡贡献值 */
  11. };

点击(此处)折叠或打开

  1. struct task_group {
  2.     struct cgroup_subsys_state css;

  3. #ifdef CONFIG_FAIR_GROUP_SCHED
  4.     /* schedulable entities of this group on each cpu */
  5.     struct sched_entity **se;
  6.     /* runqueue "owned" by this group on each cpu */
  7.     struct cfs_rq **cfs_rq;
  8.     unsigned long shares;

  9. #ifdef    CONFIG_SMP
  10.     atomic_long_t load_avg;
  11.     atomic_t runnable_avg;
  12. #endif
  13. #endif

  14. #ifdef CONFIG_RT_GROUP_SCHED
  15.     struct sched_rt_entity **rt_se;
  16.     struct rt_rq **rt_rq;

  17.     struct rt_bandwidth rt_bandwidth;
  18. #endif

  19.     struct rcu_head rcu;
  20.     struct list_head list;

  21.     struct task_group *parent;
  22.     struct list_head siblings;
  23.     struct list_head children;

  24. #ifdef CONFIG_SCHED_AUTOGROUP
  25.     struct autogroup *autogroup;
  26. #endif

  27.     struct cfs_bandwidth cfs_bandwidth;
  28. };



点击(此处)折叠或打开

  1. /* CFS-related fields in a runqueue */
  2. struct cfs_rq {
  3.     struct load_weight load;
  4.     unsigned int nr_running, h_nr_running;

  5.     u64 exec_clock;
  6.     u64 min_vruntime;
  7. #ifndef CONFIG_64BIT
  8.     u64 min_vruntime_copy;
  9. #endif

  10.     struct rb_root tasks_timeline;
  11.     struct rb_node *rb_leftmost;

  12.     /*
  13.      * 'curr' points to currently running entity on this cfs_rq.
  14.      * It is set to NULL otherwise (i.e when none are currently running).
  15.      */
  16.     struct sched_entity *curr, *next, *last, *skip;

  17. #ifdef    CONFIG_SCHED_DEBUG
  18.     unsigned int nr_spread_over;
  19. #endif

  20. #ifdef CONFIG_SMP
  21.     /*
  22.      * CFS Load tracking
  23.      * Under CFS, load is tracked on a per-entity basis and aggregated up.
  24.      * This allows for the description of both thread and group usage (in
  25.      * the FAIR_GROUP_SCHED case).
  26.      */
  27.     unsigned long runnable_load_avg, blocked_load_avg;  /* 前一个:进入到运行队列的调度实体负载均衡总和  后一个:未进入运行队列且被阻塞无法再被调度的实体负载均衡总和 */
  28.     atomic64_t decay_counter;  /* 该cfs队列的累计运行时间,以ms为单位 */
  29.     u64 last_decay;  /* 最近一次进行负载均衡计算的时间点,以ms为单位,注意前面说过1024us是计算负载均衡的周期时间 */
  30.     atomic_long_t removed_load;  /* 阻塞部分的调度实体可能有一些已经离开该cfs队列了,此处记录离开部分的负载均衡,在定期更新的时候会从blocked_load_avg中减去 */

  31. #ifdef CONFIG_FAIR_GROUP_SCHED
  32.     /* Required to track per-cpu representation of a task_group */
  33.     u32 tg_runnable_contrib;  /* 该CFS队列对它所属的TG组的运行时负载贡献值 */
  34.     unsigned long tg_load_contrib;  /* 该CFS队列对它所属的TG组的总负载贡献值,包括 runnable_load_avg, blocked_load_avg*/

  35.     /*
  36.      * h_load = weight * f(tg)
  37.      *
  38.      * Where f(tg) is the recursive weight fraction assigned to
  39.      * this group.
  40.      */
  41.     unsigned long h_load;
  42.     u64 last_h_load_update;
  43.     struct sched_entity *h_load_next;
  44. #endif /* CONFIG_FAIR_GROUP_SCHED */
  45. #endif /* CONFIG_SMP */

  46. #ifdef CONFIG_FAIR_GROUP_SCHED
  47.     struct rq *rq;    /* cpu runqueue to which this cfs_rq is attached */

  48.     /*
  49.      * leaf cfs_rqs are those that hold tasks (lowest schedulable entity in
  50.      * a hierarchy). Non-leaf lrqs hold other higher schedulable entities
  51.      * (like users, containers etc.)
  52.      *
  53.      * leaf_cfs_rq_list ties together list of leaf cfs_rq's in a cpu. This
  54.      * list is used during load balance.
  55.      */
  56.     int on_list;
  57.     struct list_head leaf_cfs_rq_list;
  58.     struct task_group *tg;    /* group that "owns" this runqueue */

  59. #ifdef CONFIG_CFS_BANDWIDTH
  60.     int runtime_enabled;
  61.     u64 runtime_expires;
  62.     s64 runtime_remaining;

  63.     u64 throttled_clock, throttled_clock_task;
  64.     u64 throttled_clock_task_time;
  65.     int throttled, throttle_count;
  66.     struct list_head throttled_list;
  67. #endif /* CONFIG_CFS_BANDWIDTH */
  68. #endif /* CONFIG_FAIR_GROUP_SCHED */
  69. };

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