From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934576AbbI2JpA (ORCPT ); Tue, 29 Sep 2015 05:45:00 -0400 Received: from bombadil.infradead.org ([198.137.202.9]:60773 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933703AbbI2JnR (ORCPT ); Tue, 29 Sep 2015 05:43:17 -0400 Message-Id: <20150929093520.146533609@infradead.org> User-Agent: quilt/0.61-1 Date: Tue, 29 Sep 2015 11:28:30 +0200 From: Peter Zijlstra To: mingo@kernel.org Cc: linux-kernel@vger.kernel.org, torvalds@linux-foundation.org, fweisbec@gmail.com, oleg@redhat.com, umgwanakikbuti@gmail.com, tglx@linutronix.de, rostedt@goodmis.org, Peter Zijlstra Subject: [RFC][PATCH 05/11] sched: Add preempt argument to __schedule() References: <20150929092825.540553633@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline; filename=peterz-kill-preempt_active-5.patch Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org There is only a single PREEMPT_ACTIVE use in the regular __schedule() path and that is to circumvent the task->state check. Since the code setting PREEMPT_ACTIVE is the immediate caller of __schedule() we can replace this with a function argument. Signed-off-by: Peter Zijlstra (Intel) --- kernel/sched/core.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -3045,7 +3045,7 @@ pick_next_task(struct rq *rq, struct tas * * WARNING: must be called with preemption disabled! */ -static void __sched __schedule(void) +static void __sched __schedule(bool preempt) { struct task_struct *prev, *next; unsigned long *switch_count; @@ -3085,7 +3085,7 @@ static void __sched __schedule(void) rq->clock_skip_update <<= 1; /* promote REQ to ACT */ switch_count = &prev->nivcsw; - if (prev->state && !(preempt_count() & PREEMPT_ACTIVE)) { + if (!preempt && prev->state) { if (unlikely(signal_pending_state(prev->state, prev))) { prev->state = TASK_RUNNING; } else { @@ -3150,7 +3150,7 @@ asmlinkage __visible void __sched schedu sched_submit_work(tsk); do { preempt_disable(); - __schedule(); + __schedule(false); sched_preempt_enable_no_resched(); } while (need_resched()); } @@ -3191,7 +3191,7 @@ static void __sched notrace preempt_sche { do { preempt_active_enter(); - __schedule(); + __schedule(true); preempt_active_exit(); /* @@ -3256,7 +3256,7 @@ asmlinkage __visible void __sched notrac * an infinite recursion. */ prev_ctx = exception_enter(); - __schedule(); + __schedule(true); exception_exit(prev_ctx); barrier(); @@ -3285,7 +3285,7 @@ asmlinkage __visible void __sched preemp do { preempt_active_enter(); local_irq_enable(); - __schedule(); + __schedule(true); local_irq_disable(); preempt_active_exit(); } while (need_resched());