]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
Merge branch 'core-rcu-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git...
authorLinus Torvalds <torvalds@linux-foundation.org>
Tue, 3 Jun 2014 19:35:05 +0000 (12:35 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 3 Jun 2014 19:35:05 +0000 (12:35 -0700)
Pull RCU changes from Ingo Molnar:
 "The main RCU changes in this cycle were:

   - RCU torture-test changes.

   - variable-name renaming cleanup.

   - update RCU documentation.

   - miscellaneous fixes.

   - patch to suppress RCU stall warnings while sysrq requests are being
     processed"

* 'core-rcu-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (68 commits)
  rcu: Provide API to suppress stall warnings while sysrc runs
  rcu: Variable name changed in tree_plugin.h and used in tree.c
  torture: Remove unused definition
  torture: Remove __init from torture_init_begin/end
  torture: Check for multiple concurrent torture tests
  locktorture: Remove reference to nonexistent Kconfig parameter
  rcutorture: Run rcu_torture_writer at normal priority
  rcutorture: Note diffs from git commits
  rcutorture: Add missing destroy_timer_on_stack()
  rcutorture: Explicitly test synchronous grace-period primitives
  rcutorture:  Add tests for get_state_synchronize_rcu()
  rcutorture: Test RCU-sched primitives in TREE_PREEMPT_RCU kernels
  torture: Use elapsed time to detect hangs
  rcutorture: Check for rcu_torture_fqs creation errors
  torture: Better summary diagnostics for build failures
  torture: Notice if an all-zero cpumask is passed inside a critical section
  rcutorture: Make rcu_torture_reader() use cond_resched()
  sched,rcu: Make cond_resched() report RCU quiescent states
  percpu: Fix raw_cpu_inc_return()
  rcutorture: Export RCU grace-period kthread wait state to rcutorture
  ...

1  2 
kernel/sched/core.c

diff --combined kernel/sched/core.c
index 0a725167898214344878217b48d4b97270ef3bd2,64f71f183aad7b4d173378e0f2305f743a353764..71d9a9c93954e56d1e7b7406d11f0f1a91136f8c
@@@ -2592,14 -2592,8 +2592,14 @@@ pick_next_task(struct rq *rq, struct ta
        if (likely(prev->sched_class == class &&
                   rq->nr_running == rq->cfs.h_nr_running)) {
                p = fair_sched_class.pick_next_task(rq, prev);
 -              if (likely(p && p != RETRY_TASK))
 -                      return p;
 +              if (unlikely(p == RETRY_TASK))
 +                      goto again;
 +
 +              /* assumes fair_sched_class->next == idle_sched_class */
 +              if (unlikely(!p))
 +                      p = idle_sched_class.pick_next_task(rq, prev);
 +
 +              return p;
        }
  
  again:
@@@ -3130,7 -3124,6 +3130,7 @@@ __setparam_dl(struct task_struct *p, co
        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;
  }
  
  static void __setscheduler_params(struct task_struct *p,
@@@ -3195,40 -3188,17 +3195,40 @@@ __getparam_dl(struct task_struct *p, st
   * We ask for the deadline not being zero, and greater or equal
   * than the runtime, as well as the period of being zero or
   * greater than deadline. Furthermore, we have to be sure that
 - * user parameters are above the internal resolution (1us); we
 - * check sched_runtime only since it is always the smaller one.
 + * user parameters are above the internal resolution of 1us (we
 + * check sched_runtime only since it is always the smaller one) and
 + * below 2^63 ns (we have to check both sched_deadline and
 + * sched_period, as the latter can be zero).
   */
  static bool
  __checkparam_dl(const struct sched_attr *attr)
  {
 -      return attr && attr->sched_deadline != 0 &&
 -              (attr->sched_period == 0 ||
 -              (s64)(attr->sched_period   - attr->sched_deadline) >= 0) &&
 -              (s64)(attr->sched_deadline - attr->sched_runtime ) >= 0  &&
 -              attr->sched_runtime >= (2 << (DL_SCALE - 1));
 +      /* deadline != 0 */
 +      if (attr->sched_deadline == 0)
 +              return false;
 +
 +      /*
 +       * Since we truncate DL_SCALE bits, make sure we're at least
 +       * that big.
 +       */
 +      if (attr->sched_runtime < (1ULL << DL_SCALE))
 +              return false;
 +
 +      /*
 +       * Since we use the MSB for wrap-around and sign issues, make
 +       * sure it's not set (mind that period can be equal to zero).
 +       */
 +      if (attr->sched_deadline & (1ULL << 63) ||
 +          attr->sched_period & (1ULL << 63))
 +              return false;
 +
 +      /* runtime <= deadline <= period (if period != 0) */
 +      if ((attr->sched_period != 0 &&
 +           attr->sched_period < attr->sched_deadline) ||
 +          attr->sched_deadline < attr->sched_runtime)
 +              return false;
 +
 +      return true;
  }
  
  /*
@@@ -3669,7 -3639,6 +3669,7 @@@ SYSCALL_DEFINE2(sched_setparam, pid_t, 
   * sys_sched_setattr - same as above, but with extended sched_attr
   * @pid: the pid in question.
   * @uattr: structure containing the extended parameters.
 + * @flags: for future extension.
   */
  SYSCALL_DEFINE3(sched_setattr, pid_t, pid, struct sched_attr __user *, uattr,
                               unsigned int, flags)
        if (!uattr || pid < 0 || flags)
                return -EINVAL;
  
 -      if (sched_copy_attr(uattr, &attr))
 -              return -EFAULT;
 +      retval = sched_copy_attr(uattr, &attr);
 +      if (retval)
 +              return retval;
 +
 +      if (attr.sched_policy < 0)
 +              return -EINVAL;
  
        rcu_read_lock();
        retval = -ESRCH;
@@@ -3736,7 -3701,7 +3736,7 @@@ SYSCALL_DEFINE1(sched_getscheduler, pid
   */
  SYSCALL_DEFINE2(sched_getparam, pid_t, pid, struct sched_param __user *, param)
  {
 -      struct sched_param lp;
 +      struct sched_param lp = { .sched_priority = 0 };
        struct task_struct *p;
        int retval;
  
        if (retval)
                goto out_unlock;
  
 -      if (task_has_dl_policy(p)) {
 -              retval = -EINVAL;
 -              goto out_unlock;
 -      }
 -      lp.sched_priority = p->rt_priority;
 +      if (task_has_rt_policy(p))
 +              lp.sched_priority = p->rt_priority;
        rcu_read_unlock();
  
        /*
@@@ -3815,7 -3783,6 +3815,7 @@@ err_size
   * @pid: the pid in question.
   * @uattr: structure containing the extended parameters.
   * @size: sizeof(attr) for fwd/bwd comp.
 + * @flags: for future extension.
   */
  SYSCALL_DEFINE4(sched_getattr, pid_t, pid, struct sched_attr __user *, uattr,
                unsigned int, size, unsigned int, flags)
@@@ -4084,6 -4051,7 +4084,7 @@@ static void __cond_resched(void
  
  int __sched _cond_resched(void)
  {
+       rcu_cond_resched();
        if (should_resched()) {
                __cond_resched();
                return 1;
@@@ -4102,15 -4070,18 +4103,18 @@@ EXPORT_SYMBOL(_cond_resched)
   */
  int __cond_resched_lock(spinlock_t *lock)
  {
+       bool need_rcu_resched = rcu_should_resched();
        int resched = should_resched();
        int ret = 0;
  
        lockdep_assert_held(lock);
  
-       if (spin_needbreak(lock) || resched) {
+       if (spin_needbreak(lock) || resched || need_rcu_resched) {
                spin_unlock(lock);
                if (resched)
                        __cond_resched();
+               else if (unlikely(need_rcu_resched))
+                       rcu_resched();
                else
                        cpu_relax();
                ret = 1;
@@@ -4124,6 -4095,7 +4128,7 @@@ int __sched __cond_resched_softirq(void
  {
        BUG_ON(!in_softirq());
  
+       rcu_cond_resched();  /* BH disabled OK, just recording QSes. */
        if (should_resched()) {
                local_bh_enable();
                __cond_resched();
@@@ -5076,6 -5048,7 +5081,6 @@@ static int sched_cpu_active(struct noti
                                      unsigned long action, void *hcpu)
  {
        switch (action & ~CPU_TASKS_FROZEN) {
 -      case CPU_STARTING:
        case CPU_DOWN_FAILED:
                set_cpu_active((long)hcpu, true);
                return NOTIFY_OK;
@@@ -6049,8 -6022,6 +6054,8 @@@ sd_numa_init(struct sched_domain_topolo
                                        ,
                .last_balance           = jiffies,
                .balance_interval       = sd_weight,
 +              .max_newidle_lb_cost    = 0,
 +              .next_decay_max_lb_cost = jiffies,
        };
        SD_INIT_NAME(sd, NUMA);
        sd->private = &tl->data;