Re: [RFC][PATCH 08/17] sched: Drop the rq argument to sched_class::select_task_rq()

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Oleg Nesterov
Date: Monday, January 3, 2011 - 8:49 am

On 01/03, Peter Zijlstra wrote:

Ah, sorry for the confusion, I only meant sched_exec() case.
set_cpus_allowed_ptr() does need need_migrate_task(), of course.


As for set_cpus_allowed_ptr()->need_migrate_task() path, I have another
question,

	static bool need_migrate_task(struct task_struct *p)
	{
		/*
		 * If the task is not on a runqueue (and not running), then
		 * the next wake-up will properly place the task.
		 */
		smp_rmb(); /* finish_lock_switch() */
		return p->on_rq || p->on_cpu;
	}

I don't understand this smp_rmb(). Yes, finish_lock_switch() does
wmb() before it clears ->on_cpu, but how these 2 barriers can pair?

In fact, I am completely confused. I do not understand why do we
check task_running() at all. If we see on_rq == 0 && on_cpu == 1,
then this task is going to clear its on_cpu soon, once it finishes
context_switch().

Probably, this check was needed before, try_to_wake_up() could
activate the task_running() task without migrating. But, at first
glance, this is no longer possible after this series?

Oleg.

--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[RFC][PATCH 03/17] sched: Change the ttwu success details, Peter Zijlstra, (Fri Dec 24, 5:23 am)
[RFC][PATCH 04/17] sched: Clean up ttwu stats, Peter Zijlstra, (Fri Dec 24, 5:23 am)
[RFC][PATCH 05/17] x86: Optimize arch_spin_unlock_wait(), Peter Zijlstra, (Fri Dec 24, 5:23 am)
[RFC][PATCH 06/17] sched: Provide p->on_rq, Peter Zijlstra, (Fri Dec 24, 5:23 am)
[RFC][PATCH 15/17] sched: Rename ttwu_post_activation, Peter Zijlstra, (Fri Dec 24, 5:23 am)
[RFC][PATCH 17/17] sched: Sort hotplug vs ttwu queueing, Peter Zijlstra, (Fri Dec 24, 5:23 am)
Re: [RFC][PATCH 05/17] x86: Optimize arch_spin_unlock_wait(), Linus Torvalds, (Fri Dec 24, 11:26 am)
Re: [RFC][PATCH 06/17] sched: Provide p->on_rq, Yong Zhang, (Wed Dec 29, 7:14 am)
[RFC][PATCH] sembench: add stddev to the burn stats, Peter Zijlstra, (Mon Jan 3, 7:36 am)
Re: [RFC][PATCH 08/17] sched: Drop the rq argument to sche ..., Oleg Nesterov, (Mon Jan 3, 8:49 am)