Make conditional reschedule public
PATCH 8/28 Make conditional reschedule public
Make conditional reschedule public
Move the conditional reschedule entries into the common code.
Signed-off-by Con Kolivas <[email protected]>
kernel/sched.c +0 -66
@@ -3162,72 +3162,6 @@ static long ingo_sys_sched_yield(void)return 0 ; } -static inline void __cond_resched (void ) -{ -do { -add_preempt_count (PREEMPT_ACTIVE ); -schedule (); -sub_preempt_count (PREEMPT_ACTIVE ); - }while (need_resched ()); -} - -int __sched cond_resched(void) -{ -if (need_resched ()) { -__cond_resched (); -return 1 ; - } -return 0 ; -} - -EXPORT_SYMBOL (cond_resched); - -/* -* cond_resched_lock() - if a reschedule is pending, drop the given lock, -* call schedule, and on return reacquire the lock. -* -* This works OK both with and without CONFIG_PREEMPT. We do strange low-level -* operations here to prevent schedule() from being called twice (once via -* spin_unlock(), once by hand). -*/ -int cond_resched_lock (spinlock_t * lock) -{ -#if defined(CONFIG_SMP ) && defined(CONFIG_PREEMPT ) -if (lock->break_lock) { - lock->break_lock =0 ; -spin_unlock (lock); -cpu_relax (); -spin_lock (lock); - } -#endif -if (need_resched ()) { -_raw_spin_unlock (lock); -preempt_enable_no_resched (); -__cond_resched (); -spin_lock (lock); -return 1 ; - } -return 0 ; -} - -EXPORT_SYMBOL (cond_resched_lock); - -int __sched cond_resched_softirq(void) -{ -BUG_ON (!in_softirq ()); - -if (need_resched ()) { -__local_bh_enable (); -__cond_resched (); -local_bh_disable (); -return 1 ; - } -return 0 ; -} - -EXPORT_SYMBOL (cond_resched_softirq); - -/** * yield - yield the current processor to other threads. *
kernel/scheduler.c +65 -0
71 lines not on this page · raw message