Re: [PATCH] generic-smp: remove kmalloc()
From: Oleg Nesterov
Date: Tue Feb 17 2009 - 13:34:41 EST
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.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/