public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Re: [RFC] Thread Migration Preemption
@ 2007-07-06  6:02 Oleg Nesterov
  2007-07-06 14:23 ` Mathieu Desnoyers
  0 siblings, 1 reply; 16+ messages in thread
From: Oleg Nesterov @ 2007-07-06  6:02 UTC (permalink / raw)
  To: Mathieu Desnoyers; +Cc: Ingo Molnar, Steven Rostedt, linux-kernel

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.


^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2007-07-14 20:41 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-06  6:02 [RFC] Thread Migration Preemption Oleg Nesterov
2007-07-06 14:23 ` Mathieu Desnoyers
2007-07-06 14:56   ` Oleg Nesterov
2007-07-11  4:49     ` [RFC] Thread Migration Preemption - v2 Mathieu Desnoyers
2007-07-11 16:36       ` Oleg Nesterov
2007-07-14 18:27         ` Mathieu Desnoyers
2007-07-14 19:56           ` Oleg Nesterov
2007-07-14 18:40         ` [RFC] Thread Migration Preemption - v3 Mathieu Desnoyers
2007-07-14 18:42         ` [RFC] Thread Migration Preemption - v4 Mathieu Desnoyers
2007-07-14 19:14           ` Peter Zijlstra
2007-07-14 20:25             ` Mathieu Desnoyers
2007-07-14 19:30           ` Peter Zijlstra
2007-07-14 20:26             ` Mathieu Desnoyers
2007-07-14 20:23           ` Oleg Nesterov
2007-07-14 20:33             ` Mathieu Desnoyers
2007-07-14 20:42               ` Oleg Nesterov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox