Skip to content

Commit 7519cce

Browse files
Lai Jiangshanpaulmck
authored andcommitted
net,rcu: convert call_rcu(ip_sf_socklist_reclaim) to kfree_rcu()
The rcu callback ip_sf_socklist_reclaim() just calls a kfree(), so we use kfree_rcu() instead of the call_rcu(ip_sf_socklist_reclaim). Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com> Acked-by: David S. Miller <davem@davemloft.net> Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com> Reviewed-by: Josh Triplett <josh@joshtriplett.org>
1 parent 42ea299 commit 7519cce

1 file changed

Lines changed: 3 additions & 9 deletions

File tree

‎net/ipv4/igmp.c‎

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1830,12 +1830,6 @@ int ip_mc_join_group(struct sock *sk , struct ip_mreqn *imr)
18301830
}
18311831
EXPORT_SYMBOL(ip_mc_join_group);
18321832

1833-
static void ip_sf_socklist_reclaim(struct rcu_head *rp)
1834-
{
1835-
kfree(container_of(rp, struct ip_sf_socklist, rcu));
1836-
/* sk_omem_alloc should have been decreased by the caller*/
1837-
}
1838-
18391833
static int ip_mc_leave_src(struct sock *sk, struct ip_mc_socklist *iml,
18401834
struct in_device *in_dev)
18411835
{
@@ -1852,7 +1846,7 @@ static int ip_mc_leave_src(struct sock *sk, struct ip_mc_socklist *iml,
18521846
rcu_assign_pointer(iml->sflist, NULL);
18531847
/* decrease mem now to avoid the memleak warning */
18541848
atomic_sub(IP_SFLSIZE(psf->sl_max), &sk->sk_omem_alloc);
1855-
call_rcu(&psf->rcu, ip_sf_socklist_reclaim);
1849+
kfree_rcu(psf, rcu);
18561850
return err;
18571851
}
18581852

@@ -2020,7 +2014,7 @@ int ip_mc_source(int add, int omode, struct sock *sk, struct
20202014
newpsl->sl_addr[i] = psl->sl_addr[i];
20212015
/* decrease mem now to avoid the memleak warning */
20222016
atomic_sub(IP_SFLSIZE(psl->sl_max), &sk->sk_omem_alloc);
2023-
call_rcu(&psl->rcu, ip_sf_socklist_reclaim);
2017+
kfree_rcu(psl, rcu);
20242018
}
20252019
rcu_assign_pointer(pmc->sflist, newpsl);
20262020
psl = newpsl;
@@ -2121,7 +2115,7 @@ int ip_mc_msfilter(struct sock *sk, struct ip_msfilter *msf, int ifindex)
21212115
psl->sl_count, psl->sl_addr, 0);
21222116
/* decrease mem now to avoid the memleak warning */
21232117
atomic_sub(IP_SFLSIZE(psl->sl_max), &sk->sk_omem_alloc);
2124-
call_rcu(&psl->rcu, ip_sf_socklist_reclaim);
2118+
kfree_rcu(psl, rcu);
21252119
} else
21262120
(void) ip_mc_del_src(in_dev, &msf->imsf_multiaddr, pmc->sfmode,
21272121
0, NULL, 0);

0 commit comments

Comments
 (0)