Messages in this thread | | | Date | Tue, 10 Sep 2013 10:32:15 +0800 | From | Wang YanQing <> | Subject | Re: [PATCH v1 1/3] SMP: kill redundant call_function_data->cpumask_ipi field |
| |
On Sun, Sep 08, 2013 at 11:22:23PM +0800, Jiang Liu wrote: > From: Jiang Liu <jiang.liu@huawei.com> > > Commit f44310b98ddb7 "smp: Fix SMP function call empty cpu mask race" > introduced field call_function_data->cpumask_ipi to resolve a race > condition in smp_call_function_many(). > > Later commit 9a46ad6d6df3 "smp: make smp_call_function_many() use logic > similar to smp_call_function_single()" fixed the same issue in another > way when optimizing smp_call_function_many(), which then obsoletes > changes introduced by commit f44310b98ddb7. So revert it. >
Yes, you are right, after commit 9a46ad6d6df3, we can revert f44310b98ddb7. Maybe use "Revert smp: Fix SMP function call empty cpu mask race" is a better subject.
> We may also keep call_function_data->cpumask_ipi field and use it to > optimize smp_call_function_many() as below: > diff --git a/kernel/smp.c b/kernel/smp.c > index fe9f773..dd852fb 100644 > --- a/kernel/smp.c > +++ b/kernel/smp.c > @@ -428,6 +428,8 @@ void smp_call_function_many(const struct cpumask *mask, > csd->info = info; > > raw_spin_lock_irqsave(&dst->lock, flags); > + if (list_empty(&dst->list)) > + cpumask_clear_cpu(cpu, cfd->cpumask_ipi); > list_add_tail(&csd->list, &dst->list); > raw_spin_unlock_irqrestore(&dst->lock, flags); > } >
Your optimization don't need to keep cpumask_ipi, just clear cfd->cpumask, and test whether cfd->cpumask is empty after "for_each_cpu(cpu, cfd->cpumask)".
Acked-by: Wang YanQing <udknight@gmail.com>
Thanks.
| |