lkml.org 
[lkml]   [2007]   [Aug]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2007-08-27 18:27    [from the cache]
©2003-2011 Jasper Spaans