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


Groups > linux.kernel > #1345350

[PATCH 2/2] sched/core: Get rid of 'cpu' variable in __schedule()

From Alexander Gordeev <agordeev@redhat.com>
Newsgroups linux.kernel
Subject [PATCH 2/2] sched/core: Get rid of 'cpu' variable in __schedule()
Date 2016-02-28 17:50 +0100
Message-ID <r7cHD-5nd-1@gated-at.bofh.it> (permalink)
References <r7cHD-5nd-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


'cpu' variable is only used to acquire the current runqueue.
By using this_rq() instead, we can get rid of that variable.

Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Alexander Gordeev <agordeev@redhat.com>
---
 kernel/sched/core.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 4e56a4d..82206f0 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -3205,10 +3205,8 @@ static void __sched notrace __schedule(bool preempt)
 	struct task_struct *prev, *next;
 	unsigned long *switch_count;
 	struct rq *rq;
-	int cpu;
 
-	cpu = smp_processor_id();
-	rq = cpu_rq(cpu);
+	rq = this_rq();
 	prev = rq->curr;
 
 	/*
@@ -3280,7 +3278,6 @@ static void __sched notrace __schedule(bool preempt)
 
 		trace_sched_switch(preempt, prev, next);
 		rq = context_switch(rq, prev, next); /* unlocks the rq */
-		cpu = cpu_of(rq);
 	} else {
 		lockdep_unpin_lock(&rq->lock);
 		raw_spin_unlock_irq(&rq->lock);
-- 
1.8.3.1

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


Thread

[PATCH 2/2] sched/core: Get rid of 'cpu' variable in __schedule() Alexander Gordeev <agordeev@redhat.com> - 2016-02-28 17:50 +0100

csiph-web