Commit 7519cce4 authored by Lai Jiangshan's avatar Lai Jiangshan Committed by Paul E. McKenney
Browse files

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: default avatarLai Jiangshan <laijs@cn.fujitsu.com>
Acked-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarPaul E. McKenney <paulmck@linux.vnet.ibm.com>
Reviewed-by: default avatarJosh Triplett <josh@joshtriplett.org>
parent 42ea299d
Loading
Loading
Loading
Loading
+3 −9
Original line number Diff line number Diff line
@@ -1830,12 +1830,6 @@ done:
}
EXPORT_SYMBOL(ip_mc_join_group);

static void ip_sf_socklist_reclaim(struct rcu_head *rp)
{
	kfree(container_of(rp, struct ip_sf_socklist, rcu));
	/* sk_omem_alloc should have been decreased by the caller*/
}

static int ip_mc_leave_src(struct sock *sk, struct ip_mc_socklist *iml,
			   struct in_device *in_dev)
{
@@ -1852,7 +1846,7 @@ static int ip_mc_leave_src(struct sock *sk, struct ip_mc_socklist *iml,
	rcu_assign_pointer(iml->sflist, NULL);
	/* decrease mem now to avoid the memleak warning */
	atomic_sub(IP_SFLSIZE(psf->sl_max), &sk->sk_omem_alloc);
	call_rcu(&psf->rcu, ip_sf_socklist_reclaim);
	kfree_rcu(psf, rcu);
	return err;
}

@@ -2020,7 +2014,7 @@ int ip_mc_source(int add, int omode, struct sock *sk, struct
				newpsl->sl_addr[i] = psl->sl_addr[i];
			/* decrease mem now to avoid the memleak warning */
			atomic_sub(IP_SFLSIZE(psl->sl_max), &sk->sk_omem_alloc);
			call_rcu(&psl->rcu, ip_sf_socklist_reclaim);
			kfree_rcu(psl, rcu);
		}
		rcu_assign_pointer(pmc->sflist, newpsl);
		psl = newpsl;
@@ -2121,7 +2115,7 @@ int ip_mc_msfilter(struct sock *sk, struct ip_msfilter *msf, int ifindex)
			psl->sl_count, psl->sl_addr, 0);
		/* decrease mem now to avoid the memleak warning */
		atomic_sub(IP_SFLSIZE(psl->sl_max), &sk->sk_omem_alloc);
		call_rcu(&psl->rcu, ip_sf_socklist_reclaim);
		kfree_rcu(psl, rcu);
	} else
		(void) ip_mc_del_src(in_dev, &msf->imsf_multiaddr, pmc->sfmode,
			0, NULL, 0);