|
@@ -733,7 +733,7 @@ int tg_nop(struct task_group *tg, void *data)
|
|
}
|
|
}
|
|
#endif
|
|
#endif
|
|
|
|
|
|
-static void set_load_weight(struct task_struct *p)
|
|
|
|
|
|
+static void set_load_weight(struct task_struct *p, bool update_load)
|
|
{
|
|
{
|
|
int prio = p->static_prio - MAX_RT_PRIO;
|
|
int prio = p->static_prio - MAX_RT_PRIO;
|
|
struct load_weight *load = &p->se.load;
|
|
struct load_weight *load = &p->se.load;
|
|
@@ -747,8 +747,16 @@ static void set_load_weight(struct task_struct *p)
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
|
|
- load->weight = scale_load(sched_prio_to_weight[prio]);
|
|
|
|
- load->inv_weight = sched_prio_to_wmult[prio];
|
|
|
|
|
|
+ /*
|
|
|
|
+ * SCHED_OTHER tasks have to update their load when changing their
|
|
|
|
+ * weight
|
|
|
|
+ */
|
|
|
|
+ if (update_load && p->sched_class == &fair_sched_class) {
|
|
|
|
+ reweight_task(p, prio);
|
|
|
|
+ } else {
|
|
|
|
+ load->weight = scale_load(sched_prio_to_weight[prio]);
|
|
|
|
+ load->inv_weight = sched_prio_to_wmult[prio];
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
static inline void enqueue_task(struct rq *rq, struct task_struct *p, int flags)
|
|
static inline void enqueue_task(struct rq *rq, struct task_struct *p, int flags)
|
|
@@ -2358,7 +2366,7 @@ int sched_fork(unsigned long clone_flags, struct task_struct *p)
|
|
p->static_prio = NICE_TO_PRIO(0);
|
|
p->static_prio = NICE_TO_PRIO(0);
|
|
|
|
|
|
p->prio = p->normal_prio = __normal_prio(p);
|
|
p->prio = p->normal_prio = __normal_prio(p);
|
|
- set_load_weight(p);
|
|
|
|
|
|
+ set_load_weight(p, false);
|
|
|
|
|
|
/*
|
|
/*
|
|
* We don't need the reset flag anymore after the fork. It has
|
|
* We don't need the reset flag anymore after the fork. It has
|
|
@@ -3805,7 +3813,7 @@ void set_user_nice(struct task_struct *p, long nice)
|
|
put_prev_task(rq, p);
|
|
put_prev_task(rq, p);
|
|
|
|
|
|
p->static_prio = NICE_TO_PRIO(nice);
|
|
p->static_prio = NICE_TO_PRIO(nice);
|
|
- set_load_weight(p);
|
|
|
|
|
|
+ set_load_weight(p, true);
|
|
old_prio = p->prio;
|
|
old_prio = p->prio;
|
|
p->prio = effective_prio(p);
|
|
p->prio = effective_prio(p);
|
|
delta = p->prio - old_prio;
|
|
delta = p->prio - old_prio;
|
|
@@ -3962,7 +3970,7 @@ static void __setscheduler_params(struct task_struct *p,
|
|
*/
|
|
*/
|
|
p->rt_priority = attr->sched_priority;
|
|
p->rt_priority = attr->sched_priority;
|
|
p->normal_prio = normal_prio(p);
|
|
p->normal_prio = normal_prio(p);
|
|
- set_load_weight(p);
|
|
|
|
|
|
+ set_load_weight(p, true);
|
|
}
|
|
}
|
|
|
|
|
|
/* Actually do priority change: must hold pi & rq lock. */
|
|
/* Actually do priority change: must hold pi & rq lock. */
|
|
@@ -5933,7 +5941,7 @@ void __init sched_init(void)
|
|
atomic_set(&rq->nr_iowait, 0);
|
|
atomic_set(&rq->nr_iowait, 0);
|
|
}
|
|
}
|
|
|
|
|
|
- set_load_weight(&init_task);
|
|
|
|
|
|
+ set_load_weight(&init_task, false);
|
|
|
|
|
|
/*
|
|
/*
|
|
* The boot idle thread does lazy MMU switching as well:
|
|
* The boot idle thread does lazy MMU switching as well:
|