public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Fix CPU bitmask truncation
@ 2002-12-16 19:13 Bjorn Helgaas
  2002-12-20 10:30 ` William Lee Irwin III
  0 siblings, 1 reply; 13+ messages in thread
From: Bjorn Helgaas @ 2002-12-16 19:13 UTC (permalink / raw)
  To: Marcelo Tosatti; +Cc: linux-kernel

This patch fixes some obviously incorrect bitmask truncations in 2.4.20.

diff -Nru a/include/linux/sched.h b/include/linux/sched.h
--- a/include/linux/sched.h	Mon Dec 16 11:58:42 2002
+++ b/include/linux/sched.h	Mon Dec 16 11:58:42 2002
@@ -482,8 +482,8 @@
     policy:		SCHED_OTHER,					\
     mm:			NULL,						\
     active_mm:		&init_mm,					\
-    cpus_runnable:	-1,						\
-    cpus_allowed:	-1,						\
+    cpus_runnable:	~0UL,						\
+    cpus_allowed:	~0UL,						\
     run_list:		LIST_HEAD_INIT(tsk.run_list),			\
     next_task:		&tsk,						\
     prev_task:		&tsk,						\
diff -Nru a/kernel/sched.c b/kernel/sched.c
--- a/kernel/sched.c	Mon Dec 16 11:58:42 2002
+++ b/kernel/sched.c	Mon Dec 16 11:58:42 2002
@@ -116,7 +116,7 @@
 
 #define idle_task(cpu) (init_tasks[cpu_number_map(cpu)])
 #define can_schedule(p,cpu) \
-	((p)->cpus_runnable & (p)->cpus_allowed & (1 << cpu))
+	((p)->cpus_runnable & (p)->cpus_allowed & (1UL << cpu))
 
 #else
 
@@ -359,7 +359,7 @@
 	if (task_on_runqueue(p))
 		goto out;
 	add_to_runqueue(p);
-	if (!synchronous || !(p->cpus_allowed & (1 << smp_processor_id())))
+	if (!synchronous || !(p->cpus_allowed & (1UL << smp_processor_id())))
 		reschedule_idle(p);
 	success = 1;
 out:


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

end of thread, other threads:[~2002-12-25 21:44 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-12-16 19:13 [PATCH] Fix CPU bitmask truncation Bjorn Helgaas
2002-12-20 10:30 ` William Lee Irwin III
2002-12-20 11:15   ` William Lee Irwin III
2002-12-20 17:00     ` Bjorn Helgaas
2002-12-25 21:43       ` Alan Cox
2002-12-25 21:54         ` Linus Torvalds
2002-12-20 12:17   ` Andreas Schwab
2002-12-20 17:12     ` William Lee Irwin III
2002-12-20 18:23     ` Jeremy Fitzhardinge
2002-12-20 20:00       ` Andreas Schwab
2002-12-20 22:57   ` Anton Blanchard
2002-12-20 23:36     ` William Lee Irwin III
2002-12-20 23:42       ` Anton Blanchard

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