Skip to content

Commit

Permalink
sched: Consolidate open coded preemptible() checks
Browse files Browse the repository at this point in the history
preempt_schedule() and preempt_schedule_context() open
code their preemptability checks.

Use the standard API instead for consolidation.

Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Li Zhong <zhong@linux.vnet.ibm.com>
Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Alex Shi <alex.shi@intel.com>
Cc: Paul Turner <pjt@google.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Vincent Guittot <vincent.guittot@linaro.org>
  • Loading branch information
Frederic Weisbecker committed Aug 12, 2013
1 parent ae920eb commit fbb00b5
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
3 changes: 1 addition & 2 deletions kernel/context_tracking.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,9 @@ void user_enter(void)
*/
void __sched notrace preempt_schedule_context(void)
{
struct thread_info *ti = current_thread_info();
enum ctx_state prev_ctx;

if (likely(ti->preempt_count || irqs_disabled()))
if (likely(!preemptible()))
return;

/*
Expand Down
4 changes: 1 addition & 3 deletions kernel/sched/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -2510,13 +2510,11 @@ void __sched schedule_preempt_disabled(void)
*/
asmlinkage void __sched notrace preempt_schedule(void)
{
struct thread_info *ti = current_thread_info();

/*
* If there is a non-zero preempt_count or interrupts are disabled,
* we do not want to preempt the current task. Just return..
*/
if (likely(ti->preempt_count || irqs_disabled()))
if (likely(!preemptible()))
return;

do {
Expand Down

0 comments on commit fbb00b5

Please sign in to comment.