Merge branch 'pm-cpufreq'
[linux-2.6-microblaze.git] / kernel / sched / sched.h
index 5fa0290..3d3e579 100644 (file)
@@ -1103,7 +1103,7 @@ struct rq {
        unsigned int            core_sched_seq;
        struct rb_root          core_tree;
 
-       /* shared state */
+       /* shared state -- careful with sched_core_cpu_deactivate() */
        unsigned int            core_task_seq;
        unsigned int            core_pick_seq;
        unsigned long           core_cookie;
@@ -2244,6 +2244,7 @@ extern struct task_struct *pick_next_task_idle(struct rq *rq);
 #define SCA_CHECK              0x01
 #define SCA_MIGRATE_DISABLE    0x02
 #define SCA_MIGRATE_ENABLE     0x04
+#define SCA_USER               0x08
 
 #ifdef CONFIG_SMP
 
@@ -2265,6 +2266,9 @@ static inline struct task_struct *get_push_task(struct rq *rq)
        if (p->nr_cpus_allowed == 1)
                return NULL;
 
+       if (p->migration_disabled)
+               return NULL;
+
        rq->push_busy = true;
        return get_task_struct(p);
 }
@@ -2843,20 +2847,27 @@ static __always_inline
 unsigned long uclamp_rq_util_with(struct rq *rq, unsigned long util,
                                  struct task_struct *p)
 {
-       unsigned long min_util;
-       unsigned long max_util;
+       unsigned long min_util = 0;
+       unsigned long max_util = 0;
 
        if (!static_branch_likely(&sched_uclamp_used))
                return util;
 
-       min_util = READ_ONCE(rq->uclamp[UCLAMP_MIN].value);
-       max_util = READ_ONCE(rq->uclamp[UCLAMP_MAX].value);
-
        if (p) {
-               min_util = max(min_util, uclamp_eff_value(p, UCLAMP_MIN));
-               max_util = max(max_util, uclamp_eff_value(p, UCLAMP_MAX));
+               min_util = uclamp_eff_value(p, UCLAMP_MIN);
+               max_util = uclamp_eff_value(p, UCLAMP_MAX);
+
+               /*
+                * Ignore last runnable task's max clamp, as this task will
+                * reset it. Similarly, no need to read the rq's min clamp.
+                */
+               if (rq->uclamp_flags & UCLAMP_FLAG_IDLE)
+                       goto out;
        }
 
+       min_util = max_t(unsigned long, min_util, READ_ONCE(rq->uclamp[UCLAMP_MIN].value));
+       max_util = max_t(unsigned long, max_util, READ_ONCE(rq->uclamp[UCLAMP_MAX].value));
+out:
        /*
         * Since CPU's {min,max}_util clamps are MAX aggregated considering
         * RUNNABLE tasks with _different_ clamps, we can end up with an