The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Rusty Russell <rusty@rustcorp.com.au>
To: lkml - Kernel Mailing List <linux-kernel@vger.kernel.org>
Cc: Andrew Morton <akpm@osdl.org>
Subject: [PATCH] sys_sched_setaffinity() on UP should fail for non-zero CPUs.
Date: Tue, 30 Nov 2004 15:39:24 +1100	[thread overview]
Message-ID: <1101789564.14565.23.camel@localhost.localdomain> (raw)

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


                 reply	other threads:[~2004-11-30  4:39 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1101789564.14565.23.camel@localhost.localdomain \
    --to=rusty@rustcorp.com.au \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox