|
@@ -2776,6 +2776,43 @@ static inline void
|
|
|
dequeue_load_avg(struct cfs_rq *cfs_rq, struct sched_entity *se) { }
|
|
|
#endif
|
|
|
|
|
|
+static void reweight_entity(struct cfs_rq *cfs_rq, struct sched_entity *se,
|
|
|
+ unsigned long weight)
|
|
|
+{
|
|
|
+ if (se->on_rq) {
|
|
|
+ /* commit outstanding execution time */
|
|
|
+ if (cfs_rq->curr == se)
|
|
|
+ update_curr(cfs_rq);
|
|
|
+ account_entity_dequeue(cfs_rq, se);
|
|
|
+ dequeue_runnable_load_avg(cfs_rq, se);
|
|
|
+ }
|
|
|
+ dequeue_load_avg(cfs_rq, se);
|
|
|
+
|
|
|
+ update_load_set(&se->load, weight);
|
|
|
+
|
|
|
+#ifdef CONFIG_SMP
|
|
|
+ se->avg.load_avg = div_u64(se_weight(se) * se->avg.load_sum,
|
|
|
+ LOAD_AVG_MAX - 1024 + se->avg.period_contrib);
|
|
|
+#endif
|
|
|
+
|
|
|
+ enqueue_load_avg(cfs_rq, se);
|
|
|
+ if (se->on_rq) {
|
|
|
+ account_entity_enqueue(cfs_rq, se);
|
|
|
+ enqueue_runnable_load_avg(cfs_rq, se);
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+void reweight_task(struct task_struct *p, int prio)
|
|
|
+{
|
|
|
+ struct sched_entity *se = &p->se;
|
|
|
+ struct cfs_rq *cfs_rq = cfs_rq_of(se);
|
|
|
+ struct load_weight *load = &se->load;
|
|
|
+ unsigned long weight = scale_load(sched_prio_to_weight[prio]);
|
|
|
+
|
|
|
+ reweight_entity(cfs_rq, se, weight);
|
|
|
+ load->inv_weight = sched_prio_to_wmult[prio];
|
|
|
+}
|
|
|
+
|
|
|
#ifdef CONFIG_FAIR_GROUP_SCHED
|
|
|
# ifdef CONFIG_SMP
|
|
|
/*
|
|
@@ -2878,32 +2915,6 @@ static long calc_cfs_shares(struct cfs_rq *cfs_rq)
|
|
|
}
|
|
|
# endif /* CONFIG_SMP */
|
|
|
|
|
|
-static void reweight_entity(struct cfs_rq *cfs_rq, struct sched_entity *se,
|
|
|
- unsigned long weight)
|
|
|
-{
|
|
|
- if (se->on_rq) {
|
|
|
- /* commit outstanding execution time */
|
|
|
- if (cfs_rq->curr == se)
|
|
|
- update_curr(cfs_rq);
|
|
|
- account_entity_dequeue(cfs_rq, se);
|
|
|
- dequeue_runnable_load_avg(cfs_rq, se);
|
|
|
- }
|
|
|
- dequeue_load_avg(cfs_rq, se);
|
|
|
-
|
|
|
- update_load_set(&se->load, weight);
|
|
|
-
|
|
|
-#ifdef CONFIG_SMP
|
|
|
- se->avg.load_avg = div_u64(se_weight(se) * se->avg.load_sum,
|
|
|
- LOAD_AVG_MAX - 1024 + se->avg.period_contrib);
|
|
|
-#endif
|
|
|
-
|
|
|
- enqueue_load_avg(cfs_rq, se);
|
|
|
- if (se->on_rq) {
|
|
|
- account_entity_enqueue(cfs_rq, se);
|
|
|
- enqueue_runnable_load_avg(cfs_rq, se);
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
static inline int throttled_hierarchy(struct cfs_rq *cfs_rq);
|
|
|
|
|
|
static void update_cfs_shares(struct sched_entity *se)
|