linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] sys_sched_setaffinity() on UP should fail for non-zero CPUs.
@ 2004-11-30  4:39 Rusty Russell
  0 siblings, 0 replies; only message in thread
From: Rusty Russell @ 2004-11-30  4:39 UTC (permalink / raw)
  To: lkml - Kernel Mailing List; +Cc: Andrew Morton

Name: Return EINVAL for invalid sched_setaffinity on UP
Status: Tested on 2.6.10-rc2-bk13
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>

I was a little surprised that sys_sched_setaffinity for CPU 1 didn't
fail on my UP box.  With CONFIG_SMP it would have.

Index: linux-2.6.10-rc2-bk13-Misc/include/linux/sched.h
===================================================================
--- linux-2.6.10-rc2-bk13-Misc.orig/include/linux/sched.h	2004-11-16 15:30:07.000000000 +1100
+++ linux-2.6.10-rc2-bk13-Misc/include/linux/sched.h	2004-11-30 14:09:38.000000000 +1100
@@ -13,6 +13,7 @@
 #include <linux/rbtree.h>
 #include <linux/thread_info.h>
 #include <linux/cpumask.h>
+#include <linux/errno.h>
 
 #include <asm/system.h>
 #include <asm/semaphore.h>
@@ -708,6 +709,8 @@
 #else
 static inline int set_cpus_allowed(task_t *p, cpumask_t new_mask)
 {
+	if (!cpus_intersects(new_mask, cpu_online_map))
+		return -EINVAL;
 	return 0;
 }
 #endif

-- 
A bad analogy is like a leaky screwdriver -- Richard Braakman


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2004-11-30  4:39 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-11-30  4:39 [PATCH] sys_sched_setaffinity() on UP should fail for non-zero CPUs Rusty Russell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).