preempt_schedule() and preempt_schedule_context() open code their preemptability checks. Use the standard API instead for consolidation.
Unified · Split
| @@ -87,10 +87,9 @@ void user_enter(void) · 86 unmodified lines | |||
| 87 | */ | 87 | */ |
| 88 | void __sched notrace preempt_schedule_context(void) | 88 | void __sched notrace preempt_schedule_context(void) |
| 89 | { | 89 | { |
| 90 | struct thread_info *ti = current_thread_info(); | ||
| 91 | enum ctx_state prev_ctx; | 90 | enum ctx_state prev_ctx; |
| 92 | 91 | ||
| 93 | if (likely(ti->preempt_count || irqs_disabled())) | 92 | if (likely(!preemptible())) |
| 94 | return; | 93 | return; |
| 95 | 94 | ||
| 96 | /* | 95 | /* |
| @@ -2510,13 +2510,11 @@ void __sched schedule_preempt_disabled(void) · 2509 unmodified lines | |||
| 2510 | */ | 2510 | */ |
| 2511 | asmlinkage void __sched notrace preempt_schedule(void) | 2511 | asmlinkage void __sched notrace preempt_schedule(void) |
| 2512 | { | 2512 | { |
| 2513 | struct thread_info *ti = current_thread_info(); | ||
| 2514 | |||
| 2515 | /* | 2513 | /* |
| 2516 | * If there is a non-zero preempt_count or interrupts are disabled, | 2514 | * If there is a non-zero preempt_count or interrupts are disabled, |
| 2517 | * we do not want to preempt the current task. Just return.. | 2515 | * we do not want to preempt the current task. Just return.. |
| 2518 | */ | 2516 | */ |
| 2519 | if (likely(ti->preempt_count || irqs_disabled())) | 2517 | if (likely(!preemptible())) |
| 2520 | return; | 2518 | return; |
| 2521 | 2519 | ||
| 2522 | do { | 2520 | do { |