Messages in this thread | | | Date | Tue, 17 Feb 2009 19:30:14 +0100 | From | Oleg Nesterov <> | Subject | Re: [PATCH] generic-smp: remove kmalloc() |
| |
On 02/17, Peter Zijlstra wrote: > > On Tue, 2009-02-17 at 18:40 +0100, Peter Zijlstra wrote: > > > > What do you think? > > > > While I would say, don't do that to your deadlock scenario, I do like > > the extra freedom this provides, so I'm inclined to go with this. Let me > > spin a new patch and build a kernel with it ;-) > > Should we do the same for the _single case? It too can copy the csd data > into the stack and return before calling func.
If you are going to change _many(), then I'd say it makes sense to change _single() too...
But, Peter, please think twice ;) I am not really sure we need this change.
Let's look at the deadlock scenario again,
void func(void *arg) { lock(LOCK); unlock(LOCK); }
smp_call_function(func, NULL, 0);
lock(LOCK); smp_call_function(another_func, NULL, 0); unlock(LOCK);
First of all, if this LOCK can be locked from irq, then we need lock_irq(LOCK) before the 2nd smp_call_function(). Yes, smp_call_function() removes smp_processor_id() from ->mask, but still the code above is hardly correct.
Otoh, perhaps we can allow to call smp_call_function() with irqs disabled (unless wait of course), in that case this change makes a bit more sense. Perhaps.
So this all is up to you. If you think this change does not complicate the code too much, then we can count it as minor optimization, because it can speedup smp_call_function() sometimes.
Oleg.
| |