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


Groups > linux.kernel > #1345350 > unrolled thread

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

Started byAlexander Gordeev <agordeev@redhat.com>
First post2016-02-28 17:50 +0100
Last post2016-02-28 17:50 +0100
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

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

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

FromAlexander Gordeev <agordeev@redhat.com>
Date2016-02-28 17:50 +0100
Subject[PATCH 2/2] sched/core: Get rid of 'cpu' variable in __schedule()
Message-ID<r7cHD-5nd-1@gated-at.bofh.it>
'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

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web