]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
Merge branch 'sched-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
authorLinus Torvalds <torvalds@linux-foundation.org>
Fri, 6 Feb 2015 21:34:26 +0000 (13:34 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 6 Feb 2015 21:34:26 +0000 (13:34 -0800)
Pull scheduler fixes from Ingo Molnar:
 "Misc fixes"

* 'sched-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  sched/deadline: Fix deadline parameter modification handling
  sched/wait: Remove might_sleep() from wait_event_cmd()
  sched: Fix crash if cpuset_cpumask_can_shrink() is passed an empty cpumask
  sched/fair: Avoid using uninitialized variable in preferred_group_nid()

1  2 
kernel/sched/core.c

diff --combined kernel/sched/core.c
index e628cb11b5606306e11f456471022fa65488976b,9e838095beb857608304691227702df2e8666dcc..5eab11d4b747df5a5ff75a9e6558444c37b5c18a
@@@ -1814,6 -1814,10 +1814,10 @@@ void __dl_clear_params(struct task_stru
        dl_se->dl_period = 0;
        dl_se->flags = 0;
        dl_se->dl_bw = 0;
+       dl_se->dl_throttled = 0;
+       dl_se->dl_new = 1;
+       dl_se->dl_yielded = 0;
  }
  
  /*
@@@ -1839,7 -1843,7 +1843,7 @@@ static void __sched_fork(unsigned long 
  #endif
  
        RB_CLEAR_NODE(&p->dl.rb_node);
-       hrtimer_init(&p->dl.dl_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
+       init_dl_task_timer(&p->dl);
        __dl_clear_params(p);
  
        INIT_LIST_HEAD(&p->rt.run_list);
@@@ -2049,6 -2053,9 +2053,9 @@@ static inline int dl_bw_cpus(int i
   * allocated bandwidth to reflect the new situation.
   *
   * This function is called while holding p's rq->lock.
+  *
+  * XXX we should delay bw change until the task's 0-lag point, see
+  * __setparam_dl().
   */
  static int dl_overflow(struct task_struct *p, int policy,
                       const struct sched_attr *attr)
@@@ -3251,15 -3258,31 +3258,31 @@@ __setparam_dl(struct task_struct *p, co
  {
        struct sched_dl_entity *dl_se = &p->dl;
  
-       init_dl_task_timer(dl_se);
        dl_se->dl_runtime = attr->sched_runtime;
        dl_se->dl_deadline = attr->sched_deadline;
        dl_se->dl_period = attr->sched_period ?: dl_se->dl_deadline;
        dl_se->flags = attr->sched_flags;
        dl_se->dl_bw = to_ratio(dl_se->dl_period, dl_se->dl_runtime);
-       dl_se->dl_throttled = 0;
-       dl_se->dl_new = 1;
-       dl_se->dl_yielded = 0;
+       /*
+        * Changing the parameters of a task is 'tricky' and we're not doing
+        * the correct thing -- also see task_dead_dl() and switched_from_dl().
+        *
+        * What we SHOULD do is delay the bandwidth release until the 0-lag
+        * point. This would include retaining the task_struct until that time
+        * and change dl_overflow() to not immediately decrement the current
+        * amount.
+        *
+        * Instead we retain the current runtime/deadline and let the new
+        * parameters take effect after the current reservation period lapses.
+        * This is safe (albeit pessimistic) because the 0-lag point is always
+        * before the current scheduling deadline.
+        *
+        * We can still have temporary overloads because we do not delay the
+        * change in bandwidth until that time; so admission control is
+        * not on the safe side. It does however guarantee tasks will never
+        * consume more than promised.
+        */
  }
  
  /*
@@@ -4642,6 -4665,9 +4665,9 @@@ int cpuset_cpumask_can_shrink(const str
        struct dl_bw *cur_dl_b;
        unsigned long flags;
  
+       if (!cpumask_weight(cur))
+               return ret;
        rcu_read_lock_sched();
        cur_dl_b = dl_bw_of(cpumask_any(cur));
        trial_cpus = cpumask_weight(trial);
@@@ -7292,12 -7318,13 +7318,12 @@@ void __might_sleep(const char *file, in
         * since we will exit with TASK_RUNNING make sure we enter with it,
         * otherwise we will destroy state.
         */
 -      if (WARN_ONCE(current->state != TASK_RUNNING,
 +      WARN_ONCE(current->state != TASK_RUNNING && current->task_state_change,
                        "do not call blocking ops when !TASK_RUNNING; "
                        "state=%lx set at [<%p>] %pS\n",
                        current->state,
                        (void *)current->task_state_change,
 -                      (void *)current->task_state_change))
 -              __set_current_state(TASK_RUNNING);
 +                      (void *)current->task_state_change);
  
        ___might_sleep(file, line, preempt_offset);
  }