[PATCH] sys_sched_setaffinity() on UP should fail for non-zero CPUs.

From: Rusty Russell (rusty_at_rustcorp.com.au)
Date: 11/30/04

  • Next message: Rusty Russell: "[PATCH] Fix Occasional stop_machine() Lockup with > 2 CPUs"
    To: lkml - Kernel Mailing List <linux-kernel@vger.kernel.org>
    Date:	Tue, 30 Nov 2004 15:39:24 +1100
    
    

    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
    -
    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/
    

  • Next message: Rusty Russell: "[PATCH] Fix Occasional stop_machine() Lockup with > 2 CPUs"

    Relevant Pages

    • Re: [PATCH] powernow-k8 max speed sanity check
      ... > system boots at lower speeds on battery though. ... > fail on buggy BIOSes and when upgrading the CPU. ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: CPU Hotplug: Hotplug Script And SIGPWR
      ... >>I guess a hotplug script MAY fail. ... >>your CPU hotplug script fail. ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: 0xdeadbeef vs 0xdeadbeefL
      ... about obscure rules they would fail. ... fail it" because I don't know some obscure typing rule that I wouldn't ... Do you Yahoo!? ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: I request inclusion of SAS Transport Layer and AIC-94xx into the kernel
      ... > allow us to pass an arbitrary request buffer, ... > suffice for most storage management apps. ... Sorry but I completely fail to see this argument. ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: sched_yield behavior
      ... >> CPU, to give to other tasks a chance to run. ... >> higher priority task, and the only of its priority list). ... > the exact nature of the real time constraint? ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)