mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] Hiding runqueues from direct refer at source code level
@ 2009-06-17 13:20 Hitoshi Mitake
  2009-06-17 15:03 ` [tip:sched/urgent] sched: Hide " tip-bot for Hitoshi Mitake
  2009-06-17 16:33 ` [tip:sched/urgent] sched: Hide runqueues from direct refer at source code level tip-bot for Hitoshi Mitake
  0 siblings, 2 replies; 11+ messages in thread
From: Hitoshi Mitake @ 2009-06-17 13:20 UTC (permalink / raw)
  To: Ingo Molnar, linux-kernel



Hi,

I found a trivial problem in sched.c and sched_debug.c .
There are some points which refer the per-cpu value "runqueues" directly.
sched.c provides nice abstraction, such as cpu_rq() and this_rq(),
so we should use these macros when looking runqueues.

I fixed these points and made patch.
If there is a reason to refer runqueues directly, sorry,
this patch doesn't make sense.
But I think that someday the abstraction will help someone.

one-line description: Hiding runqueues from direct refer at source code level

Signed-off-by: Hitoshi Mitake <mitake@dcl.info.waseda.ac.jp>

diff --git a/kernel/sched.c b/kernel/sched.c
index 8ec9d13..60dc315 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -6625,7 +6625,7 @@ EXPORT_SYMBOL(yield);
  */
 void __sched io_schedule(void)
 {
-	struct rq *rq = &__raw_get_cpu_var(runqueues);
+	struct rq *rq = this_rq();
 
 	delayacct_blkio_start();
 	atomic_inc(&rq->nr_iowait);
@@ -6637,7 +6637,7 @@ EXPORT_SYMBOL(io_schedule);
 
 long __sched io_schedule_timeout(long timeout)
 {
-	struct rq *rq = &__raw_get_cpu_var(runqueues);
+	struct rq *rq = this_rq();
 	long ret;
 
 	delayacct_blkio_start();
diff --git a/kernel/sched_debug.c b/kernel/sched_debug.c
index 467ca72..70c7e0b 100644
--- a/kernel/sched_debug.c
+++ b/kernel/sched_debug.c
@@ -162,7 +162,7 @@ void print_cfs_rq(struct seq_file *m, int cpu, struct cfs_rq *cfs_rq)
 {
 	s64 MIN_vruntime = -1, min_vruntime, max_vruntime = -1,
 		spread, rq0_min_vruntime, spread0;
-	struct rq *rq = &per_cpu(runqueues, cpu);
+	struct rq *rq = cpu_rq(cpu);
 	struct sched_entity *last;
 	unsigned long flags;
 
@@ -191,7 +191,7 @@ void print_cfs_rq(struct seq_file *m, int cpu, struct cfs_rq *cfs_rq)
 	if (last)
 		max_vruntime = last->vruntime;
 	min_vruntime = cfs_rq->min_vruntime;
-	rq0_min_vruntime = per_cpu(runqueues, 0).cfs.min_vruntime;
+	rq0_min_vruntime = cpu_rq(0)->cfs.min_vruntime;
 	spin_unlock_irqrestore(&rq->lock, flags);
 	SEQ_printf(m, "  .%-30s: %Ld.%06ld\n", "MIN_vruntime",
 			SPLIT_NS(MIN_vruntime));
@@ -248,7 +248,7 @@ void print_rt_rq(struct seq_file *m, int cpu, struct rt_rq *rt_rq)
 
 static void print_cpu(struct seq_file *m, int cpu)
 {
-	struct rq *rq = &per_cpu(runqueues, cpu);
+	struct rq *rq = cpu_rq(cpu);
 
 #ifdef CONFIG_X86
 	{

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2009-06-29  7:25 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-06-17 13:20 [PATCH] Hiding runqueues from direct refer at source code level Hitoshi Mitake
2009-06-17 15:03 ` [tip:sched/urgent] sched: Hide " tip-bot for Hitoshi Mitake
2009-06-17 16:31   ` Ingo Molnar
2009-06-18 10:14     ` Hitoshi Mitake
2009-06-22 15:35       ` Ingo Molnar
2009-06-23  4:29         ` Hitoshi Mitake
2009-06-29  3:59           ` Hitoshi Mitake
2009-06-29  4:11             ` Ingo Molnar
2009-06-29  5:44               ` [PATCH] sched: Hide runqueues from direct refer at source code level for __raw_get_cpu_var() Hitoshi Mitake
2009-06-29  7:24                 ` [tip:sched/core] sched: Hide runqueues from direct reference " tip-bot for Hitoshi Mitake
2009-06-17 16:33 ` [tip:sched/urgent] sched: Hide runqueues from direct refer at source code level tip-bot for Hitoshi Mitake

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome