基于androidq的code来看内核调度
2、set_load_weight
static_prio:静态优先级是和nice关联的一个值
静态优先级不会随时间改变,内核不会主动修改它,只能通过系统调用 nice 去修改 static_prio,MAX_RT_PRIO的值是100,static_prio的取值范围是100~139
int prio = p->static_prio - MAX_RT_PRIO; 刚好找到对应的sched_prio_to_weight中的值,所以static_prio
task处于idle状态,他的优先级是固定的3,inv_weight也是固定的
/*
* To aid in avoiding the subversion(颠覆) of "niceness" due to uneven(不均匀) distribution(分配)
* of tasks with abnormal(不正常的) "nice" values across CPUs the contribution(贡献) that
* each task makes to its run queue's load is weighted according to its
* scheduling class and "nice" value. For SCHED_NORMAL tasks this is just a
* scaled version of the new time slice allocation that they receive on time
* slice expiry(到期) etc.
*/
#define WEIGHT_IDLEPRIO 3
#define WMULT_IDLEPRIO