Subject: sched: Use schedule_preempt_disabled() From: Thomas Gleixner Date: Mon, 21 Mar 2011 12:33:18 +0100 Coccinelle based conversion. Signed-off-by: Thomas Gleixner --- arch/arm/kernel/process.c | 4 +--- arch/avr32/kernel/process.c | 4 +--- arch/blackfin/kernel/process.c | 4 +--- arch/cris/kernel/process.c | 4 +--- arch/frv/kernel/process.c | 4 +--- arch/h8300/kernel/process.c | 4 +--- arch/ia64/kernel/process.c | 4 +--- arch/m32r/kernel/process.c | 4 +--- arch/m68k/kernel/process_mm.c | 4 +--- arch/m68k/kernel/process_no.c | 4 +--- arch/microblaze/kernel/process.c | 4 +--- arch/mips/kernel/process.c | 4 +--- arch/mn10300/kernel/process.c | 4 +--- arch/parisc/kernel/process.c | 4 +--- arch/powerpc/kernel/idle.c | 8 ++++---- arch/powerpc/platforms/iseries/setup.c | 8 ++------ arch/s390/kernel/process.c | 4 +--- arch/score/kernel/process.c | 4 +--- arch/sh/kernel/idle.c | 4 +--- arch/sparc/kernel/process_32.c | 8 ++------ arch/sparc/kernel/process_64.c | 10 ++++------ arch/tile/kernel/process.c | 4 +--- arch/x86/kernel/process_32.c | 4 +--- arch/x86/kernel/process_64.c | 4 +--- arch/xtensa/kernel/process.c | 4 +--- init/main.c | 5 +---- kernel/mutex.c | 4 +--- kernel/softirq.c | 4 +--- 28 files changed, 36 insertions(+), 95 deletions(-) Index: linux-3.2/arch/arm/kernel/process.c =================================================================== --- linux-3.2.orig/arch/arm/kernel/process.c +++ linux-3.2/arch/arm/kernel/process.c @@ -214,9 +214,7 @@ void cpu_idle(void) } leds_event(led_idle_end); tick_nohz_restart_sched_tick(); - preempt_enable_no_resched(); - schedule(); - preempt_disable(); + schedule_preempt_disabled(); } } Index: linux-3.2/arch/avr32/kernel/process.c =================================================================== --- linux-3.2.orig/arch/avr32/kernel/process.c +++ linux-3.2/arch/avr32/kernel/process.c @@ -38,9 +38,7 @@ void cpu_idle(void) while (!need_resched()) cpu_idle_sleep(); tick_nohz_restart_sched_tick(); - preempt_enable_no_resched(); - schedule(); - preempt_disable(); + schedule_preempt_disabled(); } } Index: linux-3.2/arch/blackfin/kernel/process.c =================================================================== --- linux-3.2.orig/arch/blackfin/kernel/process.c +++ linux-3.2/arch/blackfin/kernel/process.c @@ -92,9 +92,7 @@ void cpu_idle(void) while (!need_resched()) idle(); tick_nohz_restart_sched_tick(); - preempt_enable_no_resched(); - schedule(); - preempt_disable(); + schedule_preempt_disabled(); } } Index: linux-3.2/arch/cris/kernel/process.c =================================================================== --- linux-3.2.orig/arch/cris/kernel/process.c +++ linux-3.2/arch/cris/kernel/process.c @@ -115,9 +115,7 @@ void cpu_idle (void) idle = default_idle; idle(); } - preempt_enable_no_resched(); - schedule(); - preempt_disable(); + schedule_preempt_disabled(); } } Index: linux-3.2/arch/frv/kernel/process.c =================================================================== --- linux-3.2.orig/arch/frv/kernel/process.c +++ linux-3.2/arch/frv/kernel/process.c @@ -92,9 +92,7 @@ void cpu_idle(void) idle(); } - preempt_enable_no_resched(); - schedule(); - preempt_disable(); + schedule_preempt_disabled(); } } Index: linux-3.2/arch/h8300/kernel/process.c =================================================================== --- linux-3.2.orig/arch/h8300/kernel/process.c +++ linux-3.2/arch/h8300/kernel/process.c @@ -81,9 +81,7 @@ void cpu_idle(void) while (1) { while (!need_resched()) idle(); - preempt_enable_no_resched(); - schedule(); - preempt_disable(); + schedule_preempt_disabled(); } } Index: linux-3.2/arch/ia64/kernel/process.c =================================================================== --- linux-3.2.orig/arch/ia64/kernel/process.c +++ linux-3.2/arch/ia64/kernel/process.c @@ -330,9 +330,7 @@ cpu_idle (void) normal_xtp(); #endif } - preempt_enable_no_resched(); - schedule(); - preempt_disable(); + schedule_preempt_disabled(); check_pgt_cache(); if (cpu_is_offline(cpu)) play_dead(); Index: linux-3.2/arch/m32r/kernel/process.c =================================================================== --- linux-3.2.orig/arch/m32r/kernel/process.c +++ linux-3.2/arch/m32r/kernel/process.c @@ -90,9 +90,7 @@ void cpu_idle (void) idle(); } - preempt_enable_no_resched(); - schedule(); - preempt_disable(); + schedule_preempt_disabled(); } } Index: linux-3.2/arch/m68k/kernel/process_mm.c =================================================================== --- linux-3.2.orig/arch/m68k/kernel/process_mm.c +++ linux-3.2/arch/m68k/kernel/process_mm.c @@ -94,9 +94,7 @@ void cpu_idle(void) while (1) { while (!need_resched()) idle(); - preempt_enable_no_resched(); - schedule(); - preempt_disable(); + schedule_preempt_disabled(); } } Index: linux-3.2/arch/m68k/kernel/process_no.c =================================================================== --- linux-3.2.orig/arch/m68k/kernel/process_no.c +++ linux-3.2/arch/m68k/kernel/process_no.c @@ -73,9 +73,7 @@ void cpu_idle(void) /* endless idle loop with no priority at all */ while (1) { idle(); - preempt_enable_no_resched(); - schedule(); - preempt_disable(); + schedule_preempt_disabled(); } } Index: linux-3.2/arch/microblaze/kernel/process.c =================================================================== --- linux-3.2.orig/arch/microblaze/kernel/process.c +++ linux-3.2/arch/microblaze/kernel/process.c @@ -108,9 +108,7 @@ void cpu_idle(void) idle(); tick_nohz_restart_sched_tick(); - preempt_enable_no_resched(); - schedule(); - preempt_disable(); + schedule_preempt_disabled(); check_pgt_cache(); } } Index: linux-3.2/arch/mips/kernel/process.c =================================================================== --- linux-3.2.orig/arch/mips/kernel/process.c +++ linux-3.2/arch/mips/kernel/process.c @@ -78,9 +78,7 @@ void __noreturn cpu_idle(void) play_dead(); #endif tick_nohz_restart_sched_tick(); - preempt_enable_no_resched(); - schedule(); - preempt_disable(); + schedule_preempt_disabled(); } } Index: linux-3.2/arch/mn10300/kernel/process.c =================================================================== --- linux-3.2.orig/arch/mn10300/kernel/process.c +++ linux-3.2/arch/mn10300/kernel/process.c @@ -123,9 +123,7 @@ void cpu_idle(void) idle(); } - preempt_enable_no_resched(); - schedule(); - preempt_disable(); + schedule_preempt_disabled(); } } Index: linux-3.2/arch/parisc/kernel/process.c =================================================================== --- linux-3.2.orig/arch/parisc/kernel/process.c +++ linux-3.2/arch/parisc/kernel/process.c @@ -71,9 +71,7 @@ void cpu_idle(void) while (1) { while (!need_resched()) barrier(); - preempt_enable_no_resched(); - schedule(); - preempt_disable(); + schedule_preempt_disabled(); check_pgt_cache(); } } Index: linux-3.2/arch/powerpc/kernel/idle.c =================================================================== --- linux-3.2.orig/arch/powerpc/kernel/idle.c +++ linux-3.2/arch/powerpc/kernel/idle.c @@ -94,11 +94,11 @@ void cpu_idle(void) HMT_medium(); ppc64_runlatch_on(); tick_nohz_restart_sched_tick(); - preempt_enable_no_resched(); - if (cpu_should_die()) + if (cpu_should_die()) { + preempt_enable_no_resched(); cpu_die(); - schedule(); - preempt_disable(); + } + schedule_preempt_disabled(); } } Index: linux-3.2/arch/powerpc/platforms/iseries/setup.c =================================================================== --- linux-3.2.orig/arch/powerpc/platforms/iseries/setup.c +++ linux-3.2/arch/powerpc/platforms/iseries/setup.c @@ -582,9 +582,7 @@ static void iseries_shared_idle(void) if (hvlpevent_is_pending()) process_iSeries_events(); - preempt_enable_no_resched(); - schedule(); - preempt_disable(); + schedule_preempt_disabled(); } } @@ -611,9 +609,7 @@ static void iseries_dedicated_idle(void) ppc64_runlatch_on(); tick_nohz_restart_sched_tick(); - preempt_enable_no_resched(); - schedule(); - preempt_disable(); + schedule_preempt_disabled(); } } Index: linux-3.2/arch/s390/kernel/process.c =================================================================== --- linux-3.2.orig/arch/s390/kernel/process.c +++ linux-3.2/arch/s390/kernel/process.c @@ -95,9 +95,7 @@ void cpu_idle(void) while (!need_resched()) default_idle(); tick_nohz_restart_sched_tick(); - preempt_enable_no_resched(); - schedule(); - preempt_disable(); + schedule_preempt_disabled(); } } Index: linux-3.2/arch/score/kernel/process.c =================================================================== --- linux-3.2.orig/arch/score/kernel/process.c +++ linux-3.2/arch/score/kernel/process.c @@ -53,9 +53,7 @@ void __noreturn cpu_idle(void) while (!need_resched()) barrier(); - preempt_enable_no_resched(); - schedule(); - preempt_disable(); + schedule_preempt_disabled(); } } Index: linux-3.2/arch/sh/kernel/idle.c =================================================================== --- linux-3.2.orig/arch/sh/kernel/idle.c +++ linux-3.2/arch/sh/kernel/idle.c @@ -112,9 +112,7 @@ void cpu_idle(void) } tick_nohz_restart_sched_tick(); - preempt_enable_no_resched(); - schedule(); - preempt_disable(); + schedule_preempt_disabled(); } } Index: linux-3.2/arch/sparc/kernel/process_32.c =================================================================== --- linux-3.2.orig/arch/sparc/kernel/process_32.c +++ linux-3.2/arch/sparc/kernel/process_32.c @@ -113,9 +113,7 @@ void cpu_idle(void) while (!need_resched()) cpu_relax(); } - preempt_enable_no_resched(); - schedule(); - preempt_disable(); + schedule_preempt_disabled(); check_pgt_cache(); } } @@ -138,9 +136,7 @@ void cpu_idle(void) while (!need_resched()) cpu_relax(); } - preempt_enable_no_resched(); - schedule(); - preempt_disable(); + schedule_preempt_disabled(); check_pgt_cache(); } } Index: linux-3.2/arch/sparc/kernel/process_64.c =================================================================== --- linux-3.2.orig/arch/sparc/kernel/process_64.c +++ linux-3.2/arch/sparc/kernel/process_64.c @@ -102,15 +102,13 @@ void cpu_idle(void) tick_nohz_restart_sched_tick(); - preempt_enable_no_resched(); - #ifdef CONFIG_HOTPLUG_CPU - if (cpu_is_offline(cpu)) + if (cpu_is_offline(cpu)) { + preempt_enable_no_resched(); cpu_play_dead(); + } #endif - - schedule(); - preempt_disable(); + schedule_preempt_disabled(); } } Index: linux-3.2/arch/tile/kernel/process.c =================================================================== --- linux-3.2.orig/arch/tile/kernel/process.c +++ linux-3.2/arch/tile/kernel/process.c @@ -106,9 +106,7 @@ void cpu_idle(void) current_thread_info()->status |= TS_POLLING; } tick_nohz_restart_sched_tick(); - preempt_enable_no_resched(); - schedule(); - preempt_disable(); + schedule_preempt_disabled(); } } Index: linux-3.2/arch/x86/kernel/process_32.c =================================================================== --- linux-3.2.orig/arch/x86/kernel/process_32.c +++ linux-3.2/arch/x86/kernel/process_32.c @@ -117,9 +117,7 @@ void cpu_idle(void) start_critical_timings(); } tick_nohz_restart_sched_tick(); - preempt_enable_no_resched(); - schedule(); - preempt_disable(); + schedule_preempt_disabled(); } } Index: linux-3.2/arch/x86/kernel/process_64.c =================================================================== --- linux-3.2.orig/arch/x86/kernel/process_64.c +++ linux-3.2/arch/x86/kernel/process_64.c @@ -150,9 +150,7 @@ void cpu_idle(void) } tick_nohz_restart_sched_tick(); - preempt_enable_no_resched(); - schedule(); - preempt_disable(); + schedule_preempt_disabled(); } } Index: linux-3.2/arch/xtensa/kernel/process.c =================================================================== --- linux-3.2.orig/arch/xtensa/kernel/process.c +++ linux-3.2/arch/xtensa/kernel/process.c @@ -113,9 +113,7 @@ void cpu_idle(void) while (1) { while (!need_resched()) platform_idle(); - preempt_enable_no_resched(); - schedule(); - preempt_disable(); + schedule_preempt_disabled(); } } Index: linux-3.2/init/main.c =================================================================== --- linux-3.2.orig/init/main.c +++ linux-3.2/init/main.c @@ -378,11 +378,8 @@ static noinline void __init_refok rest_i * at least once to get things moving: */ init_idle_bootup_task(current); - preempt_enable_no_resched(); - schedule(); - + schedule_preempt_disabled(); /* Call into cpu_idle with preempt disabled */ - preempt_disable(); cpu_idle(); } Index: linux-3.2/kernel/mutex.c =================================================================== --- linux-3.2.orig/kernel/mutex.c +++ linux-3.2/kernel/mutex.c @@ -240,9 +240,7 @@ __mutex_lock_common(struct mutex *lock, /* didn't get the lock, go to sleep: */ spin_unlock_mutex(&lock->wait_lock, flags); - preempt_enable_no_resched(); - schedule(); - preempt_disable(); + schedule_preempt_disabled(); spin_lock_mutex(&lock->wait_lock, flags); } Index: linux-3.2/kernel/softirq.c =================================================================== --- linux-3.2.orig/kernel/softirq.c +++ linux-3.2/kernel/softirq.c @@ -744,9 +744,7 @@ static int run_ksoftirqd(void * __bind_c while (!kthread_should_stop()) { preempt_disable(); if (!local_softirq_pending()) { - preempt_enable_no_resched(); - schedule(); - preempt_disable(); + schedule_preempt_disabled(); } __set_current_state(TASK_RUNNING);