Skip to content

Commit

Permalink
Merge branch 'sched-core-for-linus' of git://git.kernel.org/pub/scm/l…
Browse files Browse the repository at this point in the history
…inux/kernel/git/tip/linux-2.6-tip

* 'sched-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip: (24 commits)
  sched: Cleanup duplicate local variable in [enqueue|dequeue]_task_fair
  sched: Replace use of entity_key()
  sched: Separate group-scheduling code more clearly
  sched: Reorder root_domain to remove 64 bit alignment padding
  sched: Do not attempt to destroy uninitialized rt_bandwidth
  sched: Remove unused function cpu_cfs_rq()
  sched: Fix (harmless) typo 'CONFG_FAIR_GROUP_SCHED'
  sched, cgroup: Optimize load_balance_fair()
  sched: Don't update shares twice on on_rq parent
  sched: update correct entity's runtime in check_preempt_wakeup()
  xtensa: Use generic config PREEMPT definition
  h8300: Use generic config PREEMPT definition
  m32r: Use generic PREEMPT config
  sched: Skip autogroup when looking for all rt sched groups
  sched: Simplify mutex_spin_on_owner()
  sched: Remove rcu_read_lock() from wake_affine()
  sched: Generalize sleep inside spinlock detection
  sched: Make sleeping inside spinlock detection working in !CONFIG_PREEMPT
  sched: Isolate preempt counting in its own config option
  sched: Remove pointless in_atomic() definition check
  ...
  • Loading branch information
Linus Torvalds committed Jul 22, 2011
2 parents 4d4abdc + 0f31714 commit bdc7ccf
Show file tree
Hide file tree
Showing 21 changed files with 145 additions and 174 deletions.
2 changes: 1 addition & 1 deletion Documentation/DocBook/kernel-hacking.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
2 changes: 1 addition & 1 deletion Documentation/SubmitChecklist
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion Documentation/development-process/4.Coding
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion Documentation/ja_JP/SubmitChecklist
Original file line number Diff line number Diff line change
Expand Up @@ -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 を有効にした場合と無効にした場合の両方で
Expand Down
2 changes: 1 addition & 1 deletion Documentation/zh_CN/SubmitChecklist
Original file line number Diff line number Diff line change
Expand Up @@ -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����ִ��ʱ�䡣
Expand Down
4 changes: 1 addition & 3 deletions arch/h8300/Kconfig.cpu
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
12 changes: 1 addition & 11 deletions arch/m32r/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
13 changes: 1 addition & 12 deletions arch/xtensa/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion include/linux/bit_spinlock.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 defined CONFIG_PREEMPT
#elif defined CONFIG_PREEMPT_COUNT
return preempt_count();
#else
return 1;
Expand Down
4 changes: 2 additions & 2 deletions include/linux/hardirq.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion include/linux/kernel.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions include/linux/pagemap.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
/*
Expand Down Expand Up @@ -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);
Expand Down
26 changes: 17 additions & 9 deletions include/linux/preempt.h
Original file line number Diff line number Diff line change
Expand Up @@ -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(); \
Expand All @@ -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(); \
Expand Down Expand Up @@ -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

Expand Down
12 changes: 6 additions & 6 deletions include/linux/rcupdate.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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 */

Expand All @@ -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 */

Expand Down
2 changes: 1 addition & 1 deletion include/linux/sched.h
Original file line number Diff line number Diff line change
Expand Up @@ -2526,7 +2526,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
Expand Down
3 changes: 3 additions & 0 deletions kernel/Kconfig.preempt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -52,3 +53,5 @@ config PREEMPT

endchoice

config PREEMPT_COUNT
bool
Loading

0 comments on commit bdc7ccf

Please sign in to comment.