[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20070706060257.GA188@tv-sign.ru>
Date: Fri, 6 Jul 2007 10:02:57 +0400
From: Oleg Nesterov <oleg@...sign.ru>
To: Mathieu Desnoyers <mathieu.desnoyers@...ymtl.ca>
Cc: Ingo Molnar <mingo@...e.hu>, Steven Rostedt <rostedt@...dmis.org>,
linux-kernel@...r.kernel.org
Subject: Re: [RFC] Thread Migration Preemption
Mathieu Desnoyers wrote:
>
> This patch adds the ability to protect critical sections from migration to
> another CPU without disabling preemption.
>
> Typical use:
>
> migration_disable();
> local_inc(&__get_cpu_var(&my_local_t_var));
> migration_enable();
>
> --- linux-2.6-lttng.orig/kernel/sched.c 2007-07-05 16:28:15.000000000 -0400
> +++ linux-2.6-lttng/kernel/sched.c 2007-07-05 16:53:24.000000000 -0400
> @@ -1996,6 +1996,7 @@
> * 1) running (obviously), or
> * 2) cannot be migrated to this CPU due to cpus_allowed, or
> * 3) are cache-hot on their current CPU.
> + * 4) migration preemption is non 0 for this non running task.
> */
> if (!cpu_isset(this_cpu, p->cpus_allowed))
> return 0;
> @@ -2003,6 +2004,8 @@
>
> if (task_running(rq, p))
> return 0;
> + if (task_thread_info(p)->migration_count)
> + return 0;
Question: This means that the task could be preempted, but can't sleep, yes?
Because try_to_wake_up() can change ->cpu. Shouldn't might_sleep() check
->migration_count then? Or we can change try_to_wake_up().
What if the task does copy_process() under migration_disable() ? Child
gets a copy of ->migration_count.
Also, cpu_down() still can migrate this task to another CPU.
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