* [PATCH 0/3] resend, cpuset/hotplug fixes
@ 2009-09-10 19:21 Oleg Nesterov
2009-09-10 20:18 ` Rafael J. Wysocki
2009-09-10 20:53 ` Peter Zijlstra
0 siblings, 2 replies; 10+ messages in thread
From: Oleg Nesterov @ 2009-09-10 19:21 UTC (permalink / raw)
To: Andrew Morton
Cc: Gautham Shenoy, Ingo Molnar, Jiri Slaby, Lai Jiangshan, Li Zefan,
Miao Xie, Paul Menage, Peter Zijlstra, Rafael J. Wysocki,
Rusty Russell, linux-kernel
(my apologies to those who see this twice).
The 1st patch is preparation. 2-3 fix different problems, the 3rd one
depends on 2nd.
These patches change the code which I don't really understand, please
review.
As for the 3rd patch, it replaces
cpu_hotplug-dont-affect-current-tasks-affinity.patch
in -mm tree. Imho the new patch is more simple and clean, but of course
this is subjective and I am biased.
Oleg.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 0/3] resend, cpuset/hotplug fixes
2009-09-10 19:21 [PATCH 0/3] resend, cpuset/hotplug fixes Oleg Nesterov
@ 2009-09-10 20:18 ` Rafael J. Wysocki
2009-09-10 20:53 ` Peter Zijlstra
1 sibling, 0 replies; 10+ messages in thread
From: Rafael J. Wysocki @ 2009-09-10 20:18 UTC (permalink / raw)
To: Oleg Nesterov
Cc: Andrew Morton, Gautham Shenoy, Ingo Molnar, Jiri Slaby,
Lai Jiangshan, Li Zefan, Miao Xie, Paul Menage, Peter Zijlstra,
Rusty Russell, linux-kernel
Hi Oleg,
On Thursday 10 September 2009, Oleg Nesterov wrote:
> (my apologies to those who see this twice).
>
>
> The 1st patch is preparation. 2-3 fix different problems, the 3rd one
> depends on 2nd.
>
> These patches change the code which I don't really understand, please
> review.
>
>
> As for the 3rd patch, it replaces
>
> cpu_hotplug-dont-affect-current-tasks-affinity.patch
>
> in -mm tree. Imho the new patch is more simple and clean, but of course
> this is subjective and I am biased.
The patches look good to me FWIW.
Thanks a lot for taking care of this!
Rafael
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 0/3] resend, cpuset/hotplug fixes
2009-09-10 19:21 [PATCH 0/3] resend, cpuset/hotplug fixes Oleg Nesterov
2009-09-10 20:18 ` Rafael J. Wysocki
@ 2009-09-10 20:53 ` Peter Zijlstra
2009-09-11 7:15 ` Lai Jiangshan
1 sibling, 1 reply; 10+ messages in thread
From: Peter Zijlstra @ 2009-09-10 20:53 UTC (permalink / raw)
To: Oleg Nesterov
Cc: Andrew Morton, Gautham Shenoy, Ingo Molnar, Jiri Slaby,
Lai Jiangshan, Li Zefan, Miao Xie, Paul Menage, Rafael J. Wysocki,
Rusty Russell, linux-kernel
On Thu, 2009-09-10 at 21:21 +0200, Oleg Nesterov wrote:
> (my apologies to those who see this twice).
>
>
> The 1st patch is preparation. 2-3 fix different problems, the 3rd one
> depends on 2nd.
>
> These patches change the code which I don't really understand, please
> review.
>
>
> As for the 3rd patch, it replaces
>
> cpu_hotplug-dont-affect-current-tasks-affinity.patch
>
> in -mm tree. Imho the new patch is more simple and clean, but of course
> this is subjective and I am biased.
Look good to me.
Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Ingo, will you stick them in -tip?
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 0/3] resend, cpuset/hotplug fixes
2009-09-10 20:53 ` Peter Zijlstra
@ 2009-09-11 7:15 ` Lai Jiangshan
2009-09-11 7:33 ` Peter Zijlstra
` (2 more replies)
0 siblings, 3 replies; 10+ messages in thread
From: Lai Jiangshan @ 2009-09-11 7:15 UTC (permalink / raw)
To: Peter Zijlstra, Oleg Nesterov
Cc: Andrew Morton, Gautham Shenoy, Ingo Molnar, Jiri Slaby, Li Zefan,
Miao Xie, Paul Menage, Rafael J. Wysocki, Rusty Russell,
linux-kernel
Peter Zijlstra wrote:
> On Thu, 2009-09-10 at 21:21 +0200, Oleg Nesterov wrote:
>> (my apologies to those who see this twice).
>>
>>
>> The 1st patch is preparation. 2-3 fix different problems, the 3rd one
>> depends on 2nd.
>>
>> These patches change the code which I don't really understand, please
>> review.
>>
>>
>> As for the 3rd patch, it replaces
>>
>> cpu_hotplug-dont-affect-current-tasks-affinity.patch
>>
>> in -mm tree. Imho the new patch is more simple and clean, but of course
>> this is subjective and I am biased.
>
> Look good to me.
>
> Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
>
> Ingo, will you stick them in -tip?
>
>
Sorry. I was taken ill for weeks and forgot to follow these discussions.
Especially I should say sorry to Oleg.
I have different concept. cpuset_cpus_allowed() is not called at atomic
context nor non-preemptable context nor other critical context.
So it should be allowed to use mutexs. That's what I think.
There is a bug when migration_call() requires a mutex
before migration has been finished when cpu offline as Oleg described.
Bug this bug is only happened when cpu offline. cpu offline is rare and
is slowpath. I think we should fix cpu offline and ensure it requires
the mutex safely.
Oleg's patch moves all dirty things into CPUSET subsystem and makes
cpuset_cpus_allowed() does not require any mutex and increases CPUSET's
coupling. I don't feel it's good.
Anyway, Oleg's patch works good.
> > cpuset_cpus_allowed() is not only used for CPU offline.
> > >
> > > sched_setaffinity() also uses it.
>
> Sure. And it must take get_online_cpus() to avoid the races with hotplug.
Oleg hasn't answered that
"is it safe when pdflush() calls cpuset_cpus_allowed()?".
A patch may be needed to ensure pdflush() calls cpuset_cpus_allowed() safely.
One other minor thing:
Oleg's patch may introduce a trouble in PREEEMPT_RT tree, because
spinlock in RT is also mutex. Likely I'm wrong.
- Lai
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: [PATCH 0/3] resend, cpuset/hotplug fixes
2009-09-11 7:15 ` Lai Jiangshan
@ 2009-09-11 7:33 ` Peter Zijlstra
2009-09-11 7:53 ` Lai Jiangshan
2009-09-11 7:37 ` Peter Zijlstra
2009-09-11 18:03 ` Oleg Nesterov
2 siblings, 1 reply; 10+ messages in thread
From: Peter Zijlstra @ 2009-09-11 7:33 UTC (permalink / raw)
To: Lai Jiangshan
Cc: Oleg Nesterov, Andrew Morton, Gautham Shenoy, Ingo Molnar,
Jiri Slaby, Li Zefan, Miao Xie, Paul Menage, Rafael J. Wysocki,
Rusty Russell, linux-kernel
On Fri, 2009-09-11 at 15:15 +0800, Lai Jiangshan wrote:
> One other minor thing:
> Oleg's patch may introduce a trouble in PREEEMPT_RT tree, because
> spinlock in RT is also mutex. Likely I'm wrong.
But they have priority-inheritance, hence you cannot create a deadlock
through preemption. If the kstopmachine thread blocks on a mutex, the
owner gets boosted to kstopmachine's prio and runs to completion, after
that kstopmachine continues.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 0/3] resend, cpuset/hotplug fixes
2009-09-11 7:33 ` Peter Zijlstra
@ 2009-09-11 7:53 ` Lai Jiangshan
2009-09-11 7:57 ` Peter Zijlstra
0 siblings, 1 reply; 10+ messages in thread
From: Lai Jiangshan @ 2009-09-11 7:53 UTC (permalink / raw)
To: Peter Zijlstra
Cc: Oleg Nesterov, Andrew Morton, Gautham Shenoy, Ingo Molnar,
Jiri Slaby, Li Zefan, Miao Xie, Paul Menage, Rafael J. Wysocki,
Rusty Russell, linux-kernel
Peter Zijlstra wrote:
> On Fri, 2009-09-11 at 15:15 +0800, Lai Jiangshan wrote:
>> One other minor thing:
>> Oleg's patch may introduce a trouble in PREEEMPT_RT tree, because
>> spinlock in RT is also mutex. Likely I'm wrong.
>
> But they have priority-inheritance, hence you cannot create a deadlock
> through preemption. If the kstopmachine thread blocks on a mutex, the
> owner gets boosted to kstopmachine's prio and runs to completion, after
> that kstopmachine continues.
>
The deadlock is because the owner is at the dead cpu, It's not because
the owner's prio is low. priority-inheritance can't help it.
I think we need to use a raw spinlock.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 0/3] resend, cpuset/hotplug fixes
2009-09-11 7:53 ` Lai Jiangshan
@ 2009-09-11 7:57 ` Peter Zijlstra
0 siblings, 0 replies; 10+ messages in thread
From: Peter Zijlstra @ 2009-09-11 7:57 UTC (permalink / raw)
To: Lai Jiangshan
Cc: Oleg Nesterov, Andrew Morton, Gautham Shenoy, Ingo Molnar,
Jiri Slaby, Li Zefan, Miao Xie, Paul Menage, Rafael J. Wysocki,
Rusty Russell, linux-kernel
On Fri, 2009-09-11 at 15:53 +0800, Lai Jiangshan wrote:
> Peter Zijlstra wrote:
> > On Fri, 2009-09-11 at 15:15 +0800, Lai Jiangshan wrote:
> >> One other minor thing:
> >> Oleg's patch may introduce a trouble in PREEEMPT_RT tree, because
> >> spinlock in RT is also mutex. Likely I'm wrong.
> >
> > But they have priority-inheritance, hence you cannot create a deadlock
> > through preemption. If the kstopmachine thread blocks on a mutex, the
> > owner gets boosted to kstopmachine's prio and runs to completion, after
> > that kstopmachine continues.
> >
>
> The deadlock is because the owner is at the dead cpu, It's not because
> the owner's prio is low. priority-inheritance can't help it.
>
> I think we need to use a raw spinlock.
Not in mainline you don't.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 0/3] resend, cpuset/hotplug fixes
2009-09-11 7:15 ` Lai Jiangshan
2009-09-11 7:33 ` Peter Zijlstra
@ 2009-09-11 7:37 ` Peter Zijlstra
2009-09-11 18:03 ` Oleg Nesterov
2 siblings, 0 replies; 10+ messages in thread
From: Peter Zijlstra @ 2009-09-11 7:37 UTC (permalink / raw)
To: Lai Jiangshan
Cc: Oleg Nesterov, Andrew Morton, Gautham Shenoy, Ingo Molnar,
Jiri Slaby, Li Zefan, Miao Xie, Paul Menage, Rafael J. Wysocki,
Rusty Russell, linux-kernel
On Fri, 2009-09-11 at 15:15 +0800, Lai Jiangshan wrote:
>
> I have different concept. cpuset_cpus_allowed() is not called at atomic
> context nor non-preemptable context nor other critical context.
> So it should be allowed to use mutexs. That's what I think.
It hardly does any work at all, so why bother with a mutex?
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 0/3] resend, cpuset/hotplug fixes
2009-09-11 7:15 ` Lai Jiangshan
2009-09-11 7:33 ` Peter Zijlstra
2009-09-11 7:37 ` Peter Zijlstra
@ 2009-09-11 18:03 ` Oleg Nesterov
2 siblings, 0 replies; 10+ messages in thread
From: Oleg Nesterov @ 2009-09-11 18:03 UTC (permalink / raw)
To: Lai Jiangshan
Cc: Peter Zijlstra, Andrew Morton, Gautham Shenoy, Ingo Molnar,
Jiri Slaby, Li Zefan, Miao Xie, Paul Menage, Rafael J. Wysocki,
Rusty Russell, linux-kernel
On 09/11, Lai Jiangshan wrote:
>
> I have different concept. cpuset_cpus_allowed() is not called at atomic
> context nor non-preemptable context nor other critical context.
> So it should be allowed to use mutexs. That's what I think.
Well, it is called from non-preemptable context: move_task_off_dead_cpu().
That is why before this patch we had cpuset_cpus_allowed_lock(). And this
imho adds unneeded complications.
And I can't understand why sched_setaffinity() path should take the
global mutex instead of per-cpuset spinlock.
> There is a bug when migration_call() requires a mutex
> before migration has been finished when cpu offline as Oleg described.
>
> Bug this bug is only happened when cpu offline. cpu offline is rare and
> is slowpath. I think we should fix cpu offline and ensure it requires
> the mutex safely.
This is subjective, but I can't agree. I think we should fix cpusets
instead. We should try to avoid the dependencies between different
subsystems as much as possible.
> Oleg's patch moves all dirty things into CPUSET subsystem and makes
> cpuset_cpus_allowed() does not require any mutex and increases CPUSET's
> coupling. I don't feel it's good.
Again, subjective... But I can't understand "increases CPUSET's coupling".
>From my pov, this patch cleanups and simplifies the code. This was the
main motivation, the bugfix is just the "side effect". I don't understand
how this subtle cpuset_lock() can make things better. I can't understand
why we need the global lock to calc cpus_allowed.
> > > cpuset_cpus_allowed() is not only used for CPU offline.
> > > >
> > > > sched_setaffinity() also uses it.
> >
> > Sure. And it must take get_online_cpus() to avoid the races with hotplug.
>
> Oleg hasn't answered that
> "is it safe when pdflush() calls cpuset_cpus_allowed()?".
Because I didn't see such a question ;) perhaps I missed it previously...
> A patch may be needed to ensure pdflush() calls cpuset_cpus_allowed() safely.
What is wrong with pdflush()->cpuset_cpus_allowed() ? Why this is not safe?
This
cpuset_cpus_allowed(current, cpus_allowed);
set_cpus_allowed_ptr(current, cpus_allowed);
looks equally racy, with or without the patch. But this is a bit off-topic,
mm/pdflush.c has gone away.
> One other minor thing:
> Oleg's patch may introduce a trouble in PREEEMPT_RT tree, because
> spinlock in RT is also mutex. Likely I'm wrong.
Yes, probably -rt need raw_lock (as you pointed out).
Oleg.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 0/3] resend, cpuset/hotplug fixes
@ 2009-09-10 19:13 Oleg Nesterov
0 siblings, 0 replies; 10+ messages in thread
From: Oleg Nesterov @ 2009-09-10 19:13 UTC (permalink / raw)
To: Andrew Morton; +Cc: Rusty Russell, linux-kernel
The 1st patch is preparation. 2-3 fix different problems, the 3rd one
depends on 2nd.
These patches change the code which I don't really understand, please
review.
As for the 3rd patch, it replaces
cpu_hotplug-dont-affect-current-tasks-affinity.patch
in -mm tree. Imho the new patch is more simple and clean, but of course
this is subjective and I am biased.
Oleg.
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2009-09-11 18:07 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-09-10 19:21 [PATCH 0/3] resend, cpuset/hotplug fixes Oleg Nesterov
2009-09-10 20:18 ` Rafael J. Wysocki
2009-09-10 20:53 ` Peter Zijlstra
2009-09-11 7:15 ` Lai Jiangshan
2009-09-11 7:33 ` Peter Zijlstra
2009-09-11 7:53 ` Lai Jiangshan
2009-09-11 7:57 ` Peter Zijlstra
2009-09-11 7:37 ` Peter Zijlstra
2009-09-11 18:03 ` Oleg Nesterov
-- strict thread matches above, loose matches on Subject: below --
2009-09-10 19:13 Oleg Nesterov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox