]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
Merge branch 'sched/core-v2' of git://git.kernel.org/pub/scm/linux/kernel/git/frederi...
authorIngo Molnar <mingo@elte.hu>
Fri, 1 Jul 2011 11:20:51 +0000 (13:20 +0200)
committerIngo Molnar <mingo@elte.hu>
Fri, 1 Jul 2011 11:20:51 +0000 (13:20 +0200)
1  2 
include/linux/kernel.h
include/linux/sched.h
kernel/sched.c
lib/Kconfig.debug

diff --combined include/linux/kernel.h
index 953352a88336c0385e2e385f93e41c278513be7b,24b489f6659268e401a63f90ed05cb41d8115fbd..567a6f7bbeed00b76d5b8ccd56555c593ffefd6f
@@@ -121,7 -121,7 +121,7 @@@ extern int _cond_resched(void)
  # define might_resched() do { } while (0)
  #endif
  
- #ifdef CONFIG_DEBUG_SPINLOCK_SLEEP
+ #ifdef CONFIG_DEBUG_ATOMIC_SLEEP
    void __might_sleep(const char *file, int line, int preempt_offset);
  /**
   * might_sleep - annotation for functions that can sleep
@@@ -671,8 -671,8 +671,8 @@@ struct sysinfo 
  
  #ifdef __CHECKER__
  #define BUILD_BUG_ON_NOT_POWER_OF_2(n)
 -#define BUILD_BUG_ON_ZERO(e)
 -#define BUILD_BUG_ON_NULL(e)
 +#define BUILD_BUG_ON_ZERO(e) (0)
 +#define BUILD_BUG_ON_NULL(e) ((void*)0)
  #define BUILD_BUG_ON(condition)
  #else /* __CHECKER__ */
  
diff --combined include/linux/sched.h
index a837b20ba190330c23b59ec5a3fb584fc9f6308f,4ecd5cbe7e2422e9817eddf4a23eee711f88563b..9a9beef3c0fd7d27ad88ff6101a11718f4d880fb
@@@ -1547,7 -1547,7 +1547,7 @@@ struct task_struct 
  #ifdef CONFIG_TRACING
        /* state flags for use by tracers */
        unsigned long trace;
 -      /* bitmask of trace recursion */
 +      /* bitmask and counter of trace recursion */
        unsigned long trace_recursion;
  #endif /* CONFIG_TRACING */
  #ifdef CONFIG_CGROUP_MEM_RES_CTLR /* memcg uses this to do batch job */
@@@ -2195,6 -2195,7 +2195,6 @@@ static inline void mmdrop(struct mm_str
        if (unlikely(atomic_dec_and_test(&mm->mm_count)))
                __mmdrop(mm);
  }
 -extern int mm_init_cpumask(struct mm_struct *mm, struct mm_struct *oldmm);
  
  /* mmput gets rid of the mappings and all user-space */
  extern void mmput(struct mm_struct *);
@@@ -2501,7 -2502,7 +2501,7 @@@ extern int _cond_resched(void)
  
  extern int __cond_resched_lock(spinlock_t *lock);
  
- #ifdef CONFIG_PREEMPT
+ #ifdef CONFIG_PREEMPT_COUNT
  #define PREEMPT_LOCK_OFFSET   PREEMPT_OFFSET
  #else
  #define PREEMPT_LOCK_OFFSET   0
diff --combined kernel/sched.c
index e355ee72e83fbc1e611448ca2705c5fe426c1dec,a5f318b8d659af5b8343f2f8d33d6c940b95715b..4380a80c1e7ad2c1da2dbbfbc93e1e7db207208e
@@@ -605,10 -605,10 +605,10 @@@ static inline int cpu_of(struct rq *rq
  /*
   * Return the group to which this tasks belongs.
   *
 - * We use task_subsys_state_check() and extend the RCU verification
 - * with lockdep_is_held(&p->pi_lock) because cpu_cgroup_attach()
 - * holds that lock for each task it moves into the cgroup. Therefore
 - * by holding that lock, we pin the task to the current cgroup.
 + * We use task_subsys_state_check() and extend the RCU verification with
 + * pi->lock and rq->lock because cpu_cgroup_attach() holds those locks for each
 + * task it moves into the cgroup. Therefore by holding either of those locks,
 + * we pin the task to the current cgroup.
   */
  static inline struct task_group *task_group(struct task_struct *p)
  {
        struct cgroup_subsys_state *css;
  
        css = task_subsys_state_check(p, cpu_cgroup_subsys_id,
 -                      lockdep_is_held(&p->pi_lock));
 +                      lockdep_is_held(&p->pi_lock) ||
 +                      lockdep_is_held(&task_rq(p)->lock));
        tg = container_of(css, struct task_group, css);
  
        return autogroup_task_group(p, tg);
@@@ -2201,16 -2200,6 +2201,16 @@@ void set_task_cpu(struct task_struct *p
                        !(task_thread_info(p)->preempt_count & PREEMPT_ACTIVE));
  
  #ifdef CONFIG_LOCKDEP
 +      /*
 +       * The caller should hold either p->pi_lock or rq->lock, when changing
 +       * a task's CPU. ->pi_lock for waking tasks, rq->lock for runnable tasks.
 +       *
 +       * sched_move_task() holds both and thus holding either pins the cgroup,
 +       * see set_task_rq().
 +       *
 +       * Furthermore, all task_rq users should acquire both locks, see
 +       * task_rq_lock().
 +       */
        WARN_ON_ONCE(debug_locks && !(lockdep_is_held(&p->pi_lock) ||
                                      lockdep_is_held(&task_rq(p)->lock)));
  #endif
@@@ -2854,7 -2843,7 +2854,7 @@@ void sched_fork(struct task_struct *p
  #if defined(CONFIG_SMP)
        p->on_cpu = 0;
  #endif
- #ifdef CONFIG_PREEMPT
+ #ifdef CONFIG_PREEMPT_COUNT
        /* Want to start with kernel preemption disabled. */
        task_thread_info(p)->preempt_count = 1;
  #endif
@@@ -4306,8 -4295,11 +4306,8 @@@ EXPORT_SYMBOL(schedule)
  
  static inline bool owner_running(struct mutex *lock, struct task_struct *owner)
  {
 -      bool ret = false;
 -
 -      rcu_read_lock();
        if (lock->owner != owner)
 -              goto fail;
 +              return false;
  
        /*
         * Ensure we emit the owner->on_cpu, dereference _after_ checking
         */
        barrier();
  
 -      ret = owner->on_cpu;
 -fail:
 -      rcu_read_unlock();
 -
 -      return ret;
 +      return owner->on_cpu;
  }
  
  /*
@@@ -4329,21 -4325,21 +4329,21 @@@ int mutex_spin_on_owner(struct mutex *l
        if (!sched_feat(OWNER_SPIN))
                return 0;
  
 +      rcu_read_lock();
        while (owner_running(lock, owner)) {
                if (need_resched())
 -                      return 0;
 +                      break;
  
                arch_mutex_cpu_relax();
        }
 +      rcu_read_unlock();
  
        /*
 -       * If the owner changed to another task there is likely
 -       * heavy contention, stop spinning.
 +       * We break out the loop above on need_resched() and when the
 +       * owner changed, which is a sign for heavy contention. Return
 +       * success only when lock->owner is NULL.
         */
 -      if (lock->owner)
 -              return 0;
 -
 -      return 1;
 +      return lock->owner == NULL;
  }
  #endif
  
@@@ -8022,7 -8018,7 +8022,7 @@@ void __init sched_init(void
        scheduler_running = 1;
  }
  
- #ifdef CONFIG_DEBUG_SPINLOCK_SLEEP
+ #ifdef CONFIG_DEBUG_ATOMIC_SLEEP
  static inline int preempt_count_equals(int preempt_offset)
  {
        int nested = (preempt_count() & ~PREEMPT_ACTIVE) + rcu_preempt_depth();
  
  void __might_sleep(const char *file, int line, int preempt_offset)
  {
- #ifdef in_atomic
        static unsigned long prev_jiffy;        /* ratelimiting */
  
        if ((preempt_count_equals(preempt_offset) && !irqs_disabled()) ||
        if (irqs_disabled())
                print_irqtrace_events(current);
        dump_stack();
- #endif
  }
  EXPORT_SYMBOL(__might_sleep);
  #endif
diff --combined lib/Kconfig.debug
index dd373c8ee94399efad67ad5bc3adf57e51cf4a3d,81a4f3302bc83f56bff7e7f089ee3f9806dcbfe8..9f0d826cadc3721a98348e4649b7f5fd45a06a16
@@@ -648,12 -648,15 +648,15 @@@ config TRACE_IRQFLAG
          Enables hooks to interrupt enabling and disabling for
          either tracing or lock debugging.
  
- config DEBUG_SPINLOCK_SLEEP
-       bool "Spinlock debugging: sleep-inside-spinlock checking"
+ config DEBUG_ATOMIC_SLEEP
+       bool "Sleep inside atomic section checking"
+       select PREEMPT_COUNT
        depends on DEBUG_KERNEL
        help
          If you say Y here, various routines which may sleep will become very
-         noisy if they are called with a spinlock held.
+         noisy if they are called inside atomic sections: when a spinlock is
+         held, inside an rcu read side critical section, inside preempt disabled
+         sections, inside an interrupt, etc...
  
  config DEBUG_LOCKING_API_SELFTESTS
        bool "Locking API boot-time self-tests"
@@@ -697,7 -700,7 +700,7 @@@ config DEBUG_BUGVERBOS
        bool "Verbose BUG() reporting (adds 70K)" if DEBUG_KERNEL && EXPERT
        depends on BUG
        depends on ARM || AVR32 || M32R || M68K || SPARC32 || SPARC64 || \
 -                 FRV || SUPERH || GENERIC_BUG || BLACKFIN || MN10300
 +                 FRV || SUPERH || GENERIC_BUG || BLACKFIN || MN10300 || TILE
        default y
        help
          Say Y here to make BUG() panics output the file name and line number