Re: [PATCH net-next-2.6] igmp: RCU conversion of in_dev->mc_list

From: Eric Dumazet
Date: Fri Nov 12 2010 - 09:26:30 EST


Le vendredi 12 novembre 2010 Ã 14:34 +0100, Eric Dumazet a Ãcrit :
> Le vendredi 12 novembre 2010 Ã 10:22 +0100, Eric Dumazet a Ãcrit :
> > Le vendredi 12 novembre 2010 Ã 16:19 +0800, AmÃrico Wang a Ãcrit :
> > > On Fri, Nov 12, 2010 at 08:27:54AM +0100, Eric Dumazet wrote:
> >
> > > >A RCU conversion is far more complex.
> > > >
> > >
> > > Yup.
> >
> >
> > Well, actually this is easy in this case.
> >
> > I'll post a patch to do this RCU conversion.
> >
> >
>
> Note : compile tested only, I'll appreciate if someone can test it ;)
>
> Note: one patch from net-2.6 is not yet included in net-next-2.6, so
> please make sure you have it before testing ;)
>
> ( http://git.kernel.org/?p=linux/kernel/git/davem/net-2.6.git;a=commitdiff;h=18943d292facbc70e6a36fc62399ae833f64671b )
>
>
> Thanks
>
> [PATCH net-next-2.6] igmp: RCU conversion of in_dev->mc_list
>
> in_dev->mc_list is protected by one rwlock (in_dev->mc_list_lock).
>
> This can easily be converted to a RCU protection.
>
> Writers hold RTNL, so mc_list_lock is removed, not replaced by a
> spinlock.
>
> Signed-off-by: Eric Dumazet <eric.dumazet@xxxxxxxxx>
> Cc: Cypher Wu <cypher.w@xxxxxxxxx>
> Cc: AmÃrico Wang <xiyou.wangcong@xxxxxxxxx>
> ---

...

> void ip_mc_up(struct in_device *in_dev)
> {
> - struct ip_mc_list *i;
> + struct ip_mc_list *pmc;
>
> ASSERT_RTNL();
>
> ip_mc_inc_group(in_dev, IGMP_ALL_HOSTS);
>
> - for (i=in_dev->mc_list; i; i=i->next)
> - igmp_group_added(i);
> + for_each_pmc_rtnl(in_dev, pmc);
> + igmp_group_added(pmc);
> }


Oops there is an extra ; after the for_each_pmc_rtnl(in_dev, pmc)

should be

for_each_pmc_rtnl(in_dev, pmc)
igmp_group_added(pmc);



--
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/