Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1235844

[PATCH v2 04/12] sched: Add preempt argument to __schedule()

From Peter Zijlstra <peterz@infradead.org>
Newsgroups linux.kernel
Subject [PATCH v2 04/12] sched: Add preempt argument to __schedule()
Date 2015-09-30 09:40 +0200
Message-ID <qek9B-6Kx-49@gated-at.bofh.it> (permalink)
References <qek9A-6Kx-13@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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.

Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Frederic Weisbecker <fweisbec@gmail.com>
Reviewed-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
---
 kernel/sched/core.c |   12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -3037,7 +3037,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;
@@ -3077,7 +3077,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 {
@@ -3142,7 +3142,7 @@ asmlinkage __visible void __sched schedu
 	sched_submit_work(tsk);
 	do {
 		preempt_disable();
-		__schedule();
+		__schedule(false);
 		sched_preempt_enable_no_resched();
 	} while (need_resched());
 }
@@ -3183,7 +3183,7 @@ static void __sched notrace preempt_sche
 {
 	do {
 		preempt_active_enter();
-		__schedule();
+		__schedule(true);
 		preempt_active_exit();
 
 		/*
@@ -3248,7 +3248,7 @@ asmlinkage __visible void __sched notrac
 		 * an infinite recursion.
 		 */
 		prev_ctx = exception_enter();
-		__schedule();
+		__schedule(true);
 		exception_exit(prev_ctx);
 
 		barrier();
@@ -3277,7 +3277,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());


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v2 00/12] sched: Killing PREEMPT_ACTIVE Peter Zijlstra <peterz@infradead.org> - 2015-09-30 09:40 +0200
  [PATCH v2 04/12] sched: Add preempt argument to __schedule() Peter Zijlstra <peterz@infradead.org> - 2015-09-30 09:40 +0200
  [PATCH v2 06/12] sched: Stop setting PREEMPT_ACTIVE Peter Zijlstra <peterz@infradead.org> - 2015-09-30 09:40 +0200
    Re: [PATCH v2 06/12] sched: Stop setting PREEMPT_ACTIVE Frederic Weisbecker <fweisbec@gmail.com> - 2015-10-01 17:30 +0200
  [PATCH v2 08/12] sched: Simplify preempt_count tests Peter Zijlstra <peterz@infradead.org> - 2015-09-30 09:40 +0200
    Re: [PATCH v2 08/12] sched: Simplify preempt_count tests Frederic Weisbecker <fweisbec@gmail.com> - 2015-10-01 17:40 +0200
  [PATCH v2 12/12] sched: Add preempt_count invariant check Peter Zijlstra <peterz@infradead.org> - 2015-09-30 09:40 +0200
    Re: [PATCH v2 12/12] sched: Add preempt_count invariant check Steven Rostedt <rostedt@goodmis.org> - 2015-09-30 11:40 +0200
      Re: [PATCH v2 12/12] sched: Add preempt_count invariant check Peter Zijlstra <peterz@infradead.org> - 2015-09-30 13:20 +0200
  [PATCH v2 11/12] sched: More notrace Peter Zijlstra <peterz@infradead.org> - 2015-09-30 09:40 +0200
  [PATCH v2 01/12] sched: Simplify INIT_PREEMPT_COUNT Peter Zijlstra <peterz@infradead.org> - 2015-09-30 09:40 +0200
    Re: [PATCH v2 01/12] sched: Simplify INIT_PREEMPT_COUNT Steven Rostedt <rostedt@goodmis.org> - 2015-09-30 11:10 +0200
      Re: [PATCH v2 01/12] sched: Simplify INIT_PREEMPT_COUNT Thomas Gleixner <tglx@linutronix.de> - 2015-09-30 22:50 +0200
    Re: [PATCH v2 01/12] sched: Simplify INIT_PREEMPT_COUNT Frederic Weisbecker <fweisbec@gmail.com> - 2015-10-01 15:30 +0200

csiph-web