sched/core changes for v3.1
Subsystems (6)
Linus,
Please pull the latest sched-core-for-linus git tree from:
git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip.git sched-core-for-linus
Thanks,
Ingo
------------------>
Bianca Lutz (1):
sched: Do not attempt to destroy uninitialized rt_bandwidth
Frederic Weisbecker (7):
sched: Remove pointless in_atomic() definition check
sched: Isolate preempt counting in its own config option
sched: Make sleeping inside spinlock detection working in !CONFIG_PREEMPT
sched: Generalize sleep inside spinlock detection
m32r: Use generic PREEMPT config
h8300: Use generic config PREEMPT definition
xtensa: Use generic config PREEMPT definition
Jan H. Schönherr (1):
sched: Separate group-scheduling code more clearly
Jan Schoenherr (2):
sched: Fix (harmless) typo 'CONFG_FAIR_GROUP_SCHED'
sched: Remove unused function cpu_cfs_rq()
Lin Ming (1):
sched: Cleanup duplicate local variable in [enqueue|dequeue]_task_fair
Nikunj A. Dadhania (1):
sched: Remove rcu_read_lock() from wake_affine()
Paul Turner (2):
sched: update correct entity's runtime in check_preempt_wakeup()
sched: Don't update shares twice on on_rq parent
Peter Zijlstra (1):
sched, cgroup: Optimize load_balance_fair()
Richard Kennedy (1):
sched: Reorder root_domain to remove 64 bit alignment padding
Stephan Baerwolf (1):
sched: Replace use of entity_key()
Steven Rostedt (3):
sched: Change pick_next_task_rt from unlikely to likely
sched: Remove unlikely() from rt_policy() in sched.c
sched: Remove unlikely() from ttwu_post_activation
Thomas Gleixner (1):
sched: Simplify mutex_spin_on_owner()
Yong Zhang (2):
sched: Cleanup pre_schedule_rt
sched: Skip autogroup when looking for all rt sched groups
Documentation/DocBook/kernel-hacking.tmpl | 2 +- Documentation/SubmitChecklist | 2 +- Documentation/development-process/4.Coding | 2 +- Documentation/ja_JP/SubmitChecklist | 2 +- Documentation/zh_CN/SubmitChecklist | 2 +- arch/h8300/Kconfig.cpu | 4 +- arch/m32r/Kconfig | 12 +--- arch/xtensa/Kconfig | 13 +--- include/linux/bit_spinlock.h | 2 +- include/linux/hardirq.h | 4 +- include/linux/kernel.h | 2 +- include/linux/pagemap.h | 4 +- include/linux/preempt.h | 26 ++++-- include/linux/rcupdate.h | 12 ++-- include/linux/sched.h | 2 +- kernel/Kconfig.preempt | 3 + kernel/sched.c | 117 +++++++++------------------- kernel/sched_autogroup.h | 1 + kernel/sched_fair.c | 72 ++++++++++------- kernel/sched_rt.c | 26 +++++-- lib/Kconfig.debug | 9 ++- 21 files changed, 145 insertions(+), 174 deletions(-)
Documentation/DocBook/kernel-hacking.tmpl +1 -1
@@ -409,7 +409,7 @@ cond_resched(); /* Will sleep */ <para> You should always compile your kernel - <symbol>CONFIG_DEBUG_SPINLOCK_SLEEP</symbol> on, and it will warn + <symbol>CONFIG_DEBUG_ATOMIC_SLEEP</symbol> on, and it will warn you if you break these rules. If you <emphasis>do</emphasis> break the rules, you will eventually lock up your box. </para>
Documentation/SubmitChecklist +1 -1
@@ -53,7 +53,7 @@ kernel patches. 12: Has been tested with CONFIG_PREEMPT, CONFIG_DEBUG_PREEMPT, CONFIG_DEBUG_SLAB, CONFIG_DEBUG_PAGEALLOC, CONFIG_DEBUG_MUTEXES, - CONFIG_DEBUG_SPINLOCK, CONFIG_DEBUG_SPINLOCK_SLEEP all simultaneously + CONFIG_DEBUG_SPINLOCK, CONFIG_DEBUG_ATOMIC_SLEEP all simultaneously enabled. 13: Has been build- and runtime tested with and without CONFIG_SMP and
Documentation/development-process/4.Coding +1 -1
@@ -244,7 +244,7 @@ testing purposes. In particular, you should turn on: - DEBUG_SLAB can find a variety of memory allocation and use errors; it should be used on most development kernels. - - DEBUG_SPINLOCK, DEBUG_SPINLOCK_SLEEP, and DEBUG_MUTEXES will find a + - DEBUG_SPINLOCK, DEBUG_ATOMIC_SLEEP, and DEBUG_MUTEXES will find a number of common locking errors. There are quite a few other debugging options, some of which will be
Documentation/ja_JP/SubmitChecklist +1 -1
@@ -68,7 +68,7 @@ Linux カーネルパッチ投稿者向けチェックリスト 12: CONFIG_PREEMPT, CONFIG_DEBUG_PREEMPT, CONFIG_DEBUG_SLAB, CONFIG_DEBUG_PAGEALLOC, CONFIG_DEBUG_MUTEXES, CONFIG_DEBUG_SPINLOCK, - CONFIG_DEBUG_SPINLOCK_SLEEP これら全てを同時に有効にして動作確認を + CONFIG_DEBUG_ATOMIC_SLEEP これら全てを同時に有効にして動作確認を 行ってください。 13: CONFIG_SMP, CONFIG_PREEMPT を有効にした場合と無効にした場合の両方で
Documentation/zh_CN/SubmitChecklist +1 -1
@@ -67,7 +67,7 @@ Linux 12���Ѿ�ͨ��CONFIG_PREEMPT, CONFIG_DEBUG_PREEMPT, CONFIG_DEBUG_SLAB, CONFIG_DEBUG_PAGEALLOC, CONFIG_DEBUG_MUTEXES, - CONFIG_DEBUG_SPINLOCK, CONFIG_DEBUG_SPINLOCK_SLEEP���ԣ�����ͬʱ�� + CONFIG_DEBUG_SPINLOCK, CONFIG_DEBUG_ATOMIC_SLEEP���ԣ�����ͬʱ�� ʹ�ܡ� 13���Ѿ�����������ʹ�û��߲�ʹ�� CONFIG_SMP �� CONFIG_PREEMPT����ִ��ʱ�䡣
arch/h8300/Kconfig.cpu +1 -3
@@ -162,9 +162,7 @@ config H8300_TPU_CH int "TPU channel" depends on H8300_TPU -config PREEMPT - bool "Preemptible Kernel" - default n +source "kernel/Kconfig.preempt" source "mm/Kconfig"
arch/m32r/Kconfig +1 -11
@@ -268,17 +268,7 @@ config SCHED_OMIT_FRAME_POINTER bool default y -config PREEMPT - bool "Preemptible Kernel" - help - This option reduces the latency of the kernel when reacting to - real-time or interactive events by allowing a low priority process to - be preempted even if it is in kernel mode executing a system call. - This allows applications to run more reliably even when the system is - under load. - - Say Y here if you are building a kernel for a desktop, embedded - or real-time system. Say N if you are unsure. +source "kernel/Kconfig.preempt" config SMP bool "Symmetric multi-processing support"
arch/xtensa/Kconfig +1 -12
@@ -80,18 +80,7 @@ config XTENSA_UNALIGNED_USER Say Y here to enable unaligned memory access in user space. -config PREEMPT - bool "Preemptible Kernel" - help - This option reduces the latency of the kernel when reacting to - real-time or interactive events by allowing a low priority process to - be preempted even if it is in kernel mode executing a system call. - Unfortunately the kernel code has some race conditions if both - CONFIG_SMP and CONFIG_PREEMPT are enabled, so this option is - currently disabled if you are building an SMP kernel. - - Say Y here if you are building a kernel for a desktop, embedded - or real-time system. Say N if you are unsure. +source "kernel/Kconfig.preempt" config MATH_EMULATION bool "Math emulation"
include/linux/bit_spinlock.h +1 -1
@@ -88,7 +88,7 @@ static inline int bit_spin_is_locked(int bitnum, unsigned long *addr) {#if defined(CONFIG_SMP ) || defined(CONFIG_DEBUG_SPINLOCK )return test_bit (bitnum, addr); -#elif definedCONFIG_PREEMPT +#elif definedCONFIG_PREEMPT_COUNT return preempt_count ();#else return 1 ;
include/linux/hardirq.h +2 -2
@@ -93,7 +93,7 @@*/ #define in_nmi () (preempt_count() & NMI_MASK) -#if defined(CONFIG_PREEMPT ) +#if defined(CONFIG_PREEMPT_COUNT )# define PREEMPT_CHECK_OFFSET 1#else # define PREEMPT_CHECK_OFFSET 0
@@ -115,7 +115,7 @@#define in_atomic_preempt_off () \ ((preempt_count() & ~PREEMPT_ACTIVE) != PREEMPT_CHECK_OFFSET) -#ifdef CONFIG_PREEMPT +#ifdef CONFIG_PREEMPT_COUNT # define preemptible () (preempt_count() == 0 && !irqs_disabled())# define IRQ_EXIT_OFFSET (HARDIRQ_OFFSET-1)#else
include/linux/kernel.h +1 -1
@@ -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
include/linux/pagemap.h +2 -2
@@ -134,7 +134,7 @@ static inline int page_cache_get_speculative(struct page *page)VM_BUG_ON (in_interrupt ());#if !defined(CONFIG_SMP ) && defined(CONFIG_TREE_RCU ) -# ifdef CONFIG_PREEMPT +# ifdef CONFIG_PREEMPT_COUNT VM_BUG_ON (!in_atomic ());# endif /*
@@ -172,7 +172,7 @@ static inline int page_cache_add_speculative(struct page *page, int count)VM_BUG_ON (in_interrupt ());#if !defined(CONFIG_SMP ) && defined(CONFIG_TREE_RCU ) -# ifdef CONFIG_PREEMPT +# ifdef CONFIG_PREEMPT_COUNT VM_BUG_ON (!in_atomic ());# endif VM_BUG_ON (page_count (page) ==0 );
include/linux/preempt.h +17 -9
@@ -27,6 +27,21 @@ asmlinkage void preempt_schedule(void); +#define preempt_check_resched () \ +do { \ + if (unlikely(test_thread_flag(TIF_NEED_RESCHED))) \ + preempt_schedule(); \ +} while (0) + +#else /* !CONFIG_PREEMPT */ + +#define preempt_check_resched () do { } while (0) + +#endif /* CONFIG_PREEMPT */ + + +#ifdef CONFIG_PREEMPT_COUNT +#define preempt_disable () \ do { \ inc_preempt_count(); \
@@ -39,12 +54,6 @@ do { \dec_preempt_count (); \ } while (0) -#define preempt_check_resched () \ -do { \ - if (unlikely(test_thread_flag(TIF_NEED_RESCHED))) \ - preempt_schedule(); \ -} while (0) -#define preempt_enable () \ do { \ preempt_enable_no_resched(); \
@@ -80,18 +89,17 @@ do { \preempt_check_resched (); \ } while (0) -#else +#else /* !CONFIG_PREEMPT_COUNT */ #define preempt_disable () do { } while (0)#define preempt_enable_no_resched () do { } while (0)#define preempt_enable () do { } while (0) -#define preempt_check_resched () do { } while (0)#define preempt_disable_notrace () do { } while (0)#define preempt_enable_no_resched_notrace () do { } while (0)#define preempt_enable_notrace () do { } while (0) -#endif +#endif /* CONFIG_PREEMPT_COUNT */ #ifdef CONFIG_PREEMPT_NOTIFIERS
include/linux/rcupdate.h +6 -6
@@ -239,7 +239,7 @@ extern int rcu_read_lock_bh_held(void);* Check debug_lockdep_rcu_enabled() to prevent false positives during boot * and while lockdep is disabled. */ -#ifdef CONFIG_PREEMPT +#ifdef CONFIG_PREEMPT_COUNT static inline int rcu_read_lock_sched_held (void ) {int lockdep_opinion =0 ;
@@ -250,12 +250,12 @@ static inline int rcu_read_lock_sched_held(void) lockdep_opinion =lock_is_held (&rcu_sched_lock_map); return lockdep_opinion || preempt_count() != 0 || irqs_disabled(); } -#else /* #ifdef CONFIG_PREEMPT */ +#else /* #ifdef CONFIG_PREEMPT_COUNT */ static inline int rcu_read_lock_sched_held (void ) {return 1 ; } -#endif /* #else #ifdef CONFIG_PREEMPT */ +#endif /* #else #ifdef CONFIG_PREEMPT_COUNT */ #else /* #ifdef CONFIG_DEBUG_LOCK_ALLOC */
@@ -276,17 +276,17 @@ static inline int rcu_read_lock_bh_held(void) return 1; } -#ifdef CONFIG_PREEMPT +#ifdef CONFIG_PREEMPT_COUNT static inline int rcu_read_lock_sched_held (void ) {return preempt_count () !=0 ||irqs_disabled (); } -#else /* #ifdef CONFIG_PREEMPT */ +#else /* #ifdef CONFIG_PREEMPT_COUNT */ static inline int rcu_read_lock_sched_held (void ) {return 1 ; } -#endif /* #else #ifdef CONFIG_PREEMPT */ +#endif /* #else #ifdef CONFIG_PREEMPT_COUNT */ #endif /* #else #ifdef CONFIG_DEBUG_LOCK_ALLOC */
include/linux/sched.h +1 -1
@@ -2510,7 +2510,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
kernel/Kconfig.preempt +3 -0
@@ -35,6 +35,7 @@ config PREEMPT_VOLUNTARY config PREEMPT bool "Preemptible Kernel (Low-Latency Desktop)" + select PREEMPT_COUNT help This option reduces the latency of the kernel by making all kernel code (that is not executing in a critical section)
@@ -52,3 +53,5 @@ config PREEMPT endchoice +config PREEMPT_COUNT + bool
kernel/sched.c +36 -81
269 lines not on this page · raw message
kernel/sched_autogroup.h +1 -0
@@ -13,6 +13,7 @@ struct autogroup {int nice; }; +static inline bool task_group_is_autogroup (struct task_group *tg);static inline struct task_group *autogroup_task_group (struct task_struct *p,struct task_group *tg);
kernel/sched_fair.c +42 -30
159 lines not on this page · raw message
kernel/sched_rt.c +19 -7
@@ -185,11 +185,23 @@ static inline u64 sched_rt_period(struct rt_rq *rt_rq)typedef struct task_group *rt_rq_iter_t ; -#define for_each_rt_rq (rt_rq, iter, rq) \ - for (iter = list_entry_rcu(task_groups.next, typeof(*iter), list); \ - (&iter->list != &task_groups) && \ - (rt_rq = iter->rt_rq[cpu_of(rq)]); \ - iter = list_entry_rcu(iter->list.next, typeof(*iter), list)) +static inline struct task_group *next_task_group (struct task_group *tg) +{ +do { + tg =list_entry_rcu (tg->list.next, + typeof(struct task_group), list); + }while (&tg->list != &task_groups &&task_group_is_autogroup (tg)); + +if (&tg->list == &task_groups) + tg =NULL ; + +return tg; +} + +#define for_each_rt_rq (rt_rq, iter, rq) \ + for (iter = container_of(&task_groups, typeof(*iter), list); \ + (iter = next_task_group(iter)) && \ + (rt_rq = iter->rt_rq[cpu_of(rq)]);)static inline void list_add_leaf_rt_rq (struct rt_rq *rt_rq) {
@@ -1126,7 +1138,7 @@ static struct task_struct *_pick_next_task_rt(struct rq *rq) rt_rq = &rq->rt; -if (unlikely (!rt_rq->rt_nr_running)) +if (!rt_rq->rt_nr_running)return NULL ;if (rt_rq_throttled (rt_rq))
@@ -1548,7 +1560,7 @@ skip:static void pre_schedule_rt (struct rq *rq,struct task_struct *prev) {/* Try to pull RT tasks here if we lower this rq's prio */ -if (unlikely (rt_task (prev)) && rq->rt.highest_prio.curr > prev->prio) +if (rq->rt.highest_prio.curr > prev->prio)pull_rt_task (rq); }
lib/Kconfig.debug +6 -3
@@ -648,12 +648,15 @@ config TRACE_IRQFLAGS 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"