LWN.net Logo

use task_cpu() not ->thread_info->cpu in sched.c

From:  Mikael Pettersson <mikpe@csd.uu.se>
To:  torvalds@osdl.org
Subject:  [PATCH][2.5.74] use task_cpu() not ->thread_info->cpu in sched.c
Date:  Thu, 3 Jul 2003 18:10:05 +0200 (MEST)
Cc:  linux-kernel@vger.kernel.org

Linus,

This patch fixes two p->thread_info->cpu occurrences in kernel/sched.c
to use the task_cpu(p) macro instead, which is optimised on UP.
Although one of the occurrences is under #ifdef CONFIG_SMP, it's bad
style to use the raw non-optimisable form in non-arch code. Please apply.

/Mikael

--- linux-2.5.74/kernel/sched.c.~1~	2003-07-03 12:32:46.000000000 +0200
+++ linux-2.5.74/kernel/sched.c	2003-07-03 12:37:30.000000000 +0200
@@ -508,8 +508,8 @@
 		}
 #ifdef CONFIG_SMP
 	       	else
-			if (unlikely(kick) && task_running(rq, p) && (p->thread_info->cpu != smp_processor_id()))
-				smp_send_reschedule(p->thread_info->cpu);
+			if (unlikely(kick) && task_running(rq, p) && (task_cpu(p) != smp_processor_id()))
+				smp_send_reschedule(task_cpu(p));
 #endif
 		p->state = TASK_RUNNING;
 	}
@@ -1332,7 +1332,7 @@
 switch_tasks:
 	prefetch(next);
 	clear_tsk_need_resched(prev);
-	RCU_qsctr(prev->thread_info->cpu)++;
+	RCU_qsctr(task_cpu(prev))++;
 
 	if (likely(prev != next)) {
 		rq->nr_switches++;
-
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/

Copyright © 2003, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds