/* CFS-related fields in a runqueue */ struct cfs_rq { struct load_weight load; /*运行负载*/ unsignedlong nr_running; /*运行进程个数*/ u64 exec_clock; u64 min_vruntime; /*保存的最小运行时间*/ struct rb_root tasks_timeline; /*运行队列树根*/ struct rb_node *rb_leftmost; /*保存的红黑树最左边的节点,这个为最小运行时间的节点,当进程 选择下一个来运行时,直接选择这个*/ struct list_head tasks; struct list_head *balance_iterator; /* * 'curr' points to currently running entity on this cfs_rq. * It is set to NULL otherwise (i.e when none are currently running). */
unsignedint nr_spread_over; #ifdef CONFIG_FAIR_GROUP_SCHED struct rq *rq; /* cpu runqueue to which this cfs_rq is attached */ /* * leaf cfs_rqs are those that hold tasks (lowest schedulable entity in * a hierarchy). Non-leaf lrqs hold other higher schedulable entities * (like users, containers etc.) * * leaf_cfs_rq_list ties together list of leaf cfs_rq's in a cpu. This * list is used during load balance. */ struct list_head leaf_cfs_rq_list; struct task_group *tg; /* group that "owns" this runqueue */ #ifdef CONFIG_SMP /* * the part of load.weight contributed by tasks */ unsignedlong task_weight; /* * h_load = weight * f(tg) * * Where f(tg) is the recursive weight fraction assigned to * this group. */ unsignedlong h_load; /* * this cpu's part of tg->shares */ unsignedlong shares; /* * load.weight at the time we set shares */ unsignedlong rq_weight; #endif #endif };