From: Andreas Mohr Right at the very beginning of schedule(): if (likely(!current->exit_state)) { if (unlikely(in_atomic())) { can be reversed into if (unlikely(in_atomic())) { if (likely(!current->exit_state)) { This is a Good Thing since it avoids having to evaluate both checks, and both use current_thread_info() which has an inherent AGI stall risk on x86 CPUs if it cannot be inter-mingled with other unrelated opcodes. Signed-off-by: Andreas Mohr Cc: Ingo Molnar Signed-off-by: Andrew Morton --- kernel/sched.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff -puN kernel/sched.c~small-schedule-optimization kernel/sched.c --- devel/kernel/sched.c~small-schedule-optimization 2006-03-11 02:50:33.000000000 -0800 +++ devel-akpm/kernel/sched.c 2006-03-11 02:50:33.000000000 -0800 @@ -2881,8 +2881,8 @@ asmlinkage void __sched schedule(void) * schedule() atomically, we ignore that path for now. * Otherwise, whine if we are scheduling when we should not be. */ - if (likely(!current->exit_state)) { - if (unlikely(in_atomic())) { + if (unlikely(in_atomic())) { + if (likely(!current->exit_state)) { printk(KERN_ERR "BUG: scheduling while atomic: " "%s/0x%08x/%d\n", current->comm, preempt_count(), current->pid); _