4479
4480 if (unlikely(!rq->nr_running))
4481 idle_balance(cpu, rq);
4482
4483 prev->sched_class->put_prev_task(rq, prev);
4484 next = pick_next_task(rq, prev);
4485
4486 if (likely(prev != next)) {
4487 sched_info_switch(prev, next);
4488
4489 rq->nr_switches++;
4490 rq->curr = next;
4491 ++*switch_count;
4492
4493 context_switch(rq, prev, next);
4494
4495
4496
4497
4498 cpu = smp_processor_id();
4499 rq = cpu_rq(cpu);
4500 } else
4501 spin_unlock_irq(&rq->lock);
4502
4503 if (unlikely(reacquire_kernel_lock(current) < 0))
4504 goto need_resched_nonpreemptible;
4505
4506 preempt_enable_no_resched();
4507 if (unlikely(test_thread_flag(TIF_NEED_RESCHED)))
4508 goto need_resched;
4509}
4510EXPORT_SYMBOL(schedule);
4511
4512#ifdef CONFIG_PREEMPT
4513
4514
4515
4516
4517
4518asmlinkage void __sched preempt_schedule(void)
4519{