[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20070827162516.GA1398@tv-sign.ru>
Date: Mon, 27 Aug 2007 20:25:16 +0400
From: Oleg Nesterov <oleg@...sign.ru>
To: Cliff Wickman <cpw@....com>
Cc: akpm@...ux-foundation.org, ego@...ibm.com, mingo@...e.hu,
vatsa@...ibm.com, pj@....com, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/1] V3: hotplug cpu: migrate a task within its cpuset
On 08/27, Cliff Wickman wrote:
>
> --- linus.070821.orig/kernel/sched.c
> +++ linus.070821/kernel/sched.c
> @@ -61,6 +61,7 @@
> #include <linux/delayacct.h>
> #include <linux/reciprocal_div.h>
> #include <linux/unistd.h>
> +#include <linux/cpuset.h>
>
> #include <asm/tlb.h>
>
> @@ -5091,6 +5092,19 @@ restart:
> if (dest_cpu == NR_CPUS)
> dest_cpu = any_online_cpu(p->cpus_allowed);
>
> + /* try to stay on the same cpuset */
> + if (dest_cpu == NR_CPUS) {
> + rq = task_rq_lock(p, &flags);
> + /*
> + * The cpuset_cpus_allowed_locked() variant of
> + * cpuset_cpus_allowed() will not block
> + * It must be called within calls to cpuset_lock/cpuset_unlock.
> + */
> + p->cpus_allowed = cpuset_cpus_allowed_locked(p);
> + dest_cpu = any_online_cpu(p->cpus_allowed);
> + task_rq_unlock(rq, &flags);
No, no, we can't take task_lock() under rq->lock, nesting error. I think we
need a local "cpumask_t cpus_allowed = cpuset_cpus_allowed_locked()", like
sched_setaffinity() does.
task_lock() doesn't disable irqs, this means that it can't be used under any
lock which can be used from interrupt context.
Oleg.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists