2003-02-17 08:04:18

by Zwane Mwaikambo

[permalink] [raw]
Subject: [PATCH][2.5] set_cpus_allowed needs cpu_online_map BUG check

We don't want to try and migrate to offline cpus, so BUG() on it.

diff -u -r1.1.1.1 sched.c
--- linux-2.5.61-trojan/kernel/sched.c 15 Feb 2003 12:32:44 -0000 1.1.1.1
+++ linux-2.5.61-trojan/kernel/sched.c 15 Feb 2003 16:04:51 -0000
@@ -2200,11 +2221,8 @@
migration_req_t req;
runqueue_t *rq;

-#if 0 /* FIXME: Grab cpu_lock, return error on this case. --RR */
- new_mask &= cpu_online_map;
- if (!new_mask)
+ if (!(new_mask & cpu_online_map))
BUG();
-#endif

rq = task_rq_lock(p, &flags);
p->cpus_allowed = new_mask;


2003-02-17 14:40:37

by Ingo Molnar

[permalink] [raw]
Subject: Re: [PATCH][2.5] set_cpus_allowed needs cpu_online_map BUG check


On Mon, 17 Feb 2003, Zwane Mwaikambo wrote:

> We don't want to try and migrate to offline cpus, so BUG() on it.

agreed. Not much code should be exposed to the possibility of CPUs going
away.

Ingo

> diff -u -r1.1.1.1 sched.c
> --- linux-2.5.61-trojan/kernel/sched.c 15 Feb 2003 12:32:44 -0000 1.1.1.1
> +++ linux-2.5.61-trojan/kernel/sched.c 15 Feb 2003 16:04:51 -0000
> @@ -2200,11 +2221,8 @@
> migration_req_t req;
> runqueue_t *rq;
>
> -#if 0 /* FIXME: Grab cpu_lock, return error on this case. --RR */
> - new_mask &= cpu_online_map;
> - if (!new_mask)
> + if (!(new_mask & cpu_online_map))
> BUG();
> -#endif
>
> rq = task_rq_lock(p, &flags);
> p->cpus_allowed = new_mask;
>