Re: [patch 1/1] export cpu_online_map

From: Andrew Morton
Date: Wed Oct 26 2005 - 23:10:43 EST


Paul Jackson <pj@xxxxxxx> wrote:
>
> Andrew asked:
> > - Why isn't set_cpus_allowed() just a no-op on UP? Or some trivial thing
> > which tests for cpu #0?
>
> I don't know.
>
> By scanning random copies of kernels left on my drive, I can see that
> it changed from a trivial "return 0" to the more interesting check using
> cpu_online_map in one of your "linus.patch" patches in the release
> 2.6.11-rc1-mm2.
>
> But I don't know how to get to the history at this point to see what
> happened.
>
> It looks like Linus started the git history at 2.6.12-rc2.
>
> Could someone clue me in on how to find Linux history BG (before-git)?
>
> Since bk no longer works for me, I have no idea how to access any
> history prior to about 2.6.12-rc2. Ugh.

There's still bkbits.net:

http://linux.bkbits.net:8080/linux-2.6/diffs/include/linux/sched.h@xxxxxxxxx?nav=index.html|src/|src/include|src/include/linux|hist/include/linux/sched.h


From: Rusty Russell <rusty@xxxxxxxxxxxxxxx>

Return EINVAL for invalid sched_setaffinity on UP. 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.

Signed-off-by: Rusty Russell <rusty@xxxxxxxxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxx>
---

25-akpm/include/linux/sched.h | 3 +++
1 files changed, 3 insertions(+)

diff -puN include/linux/sched.h~sys_sched_setaffinity-on-up-should-fail-for-non-zero include/linux/sched.h
--- 25/include/linux/sched.h~sys_sched_setaffinity-on-up-should-fail-for-non-zero 2005-01-04 18:48:15.000000000 -0800
+++ 25-akpm/include/linux/sched.h 2005-01-04 20:24:20.010381184 -0800
@@ -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>
@@ -732,6 +733,8 @@ extern int set_cpus_allowed(task_t *p, c
#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
_

Seems silly to use cpu_online_map to test for `1'?
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/