* [PATCH] net: don't use INIT_RCU_HEAD
@ 2008-10-28 13:31 Alexey Dobriyan
2008-10-28 15:29 ` Patrick McHardy
2008-10-28 16:10 ` Paul E. McKenney
0 siblings, 2 replies; 6+ messages in thread
From: Alexey Dobriyan @ 2008-10-28 13:31 UTC (permalink / raw)
To: davem; +Cc: netdev
call_rcu() will unconditionally rewrite RCU head anyway.
Applies to
struct neigh_parms
struct neigh_table
struct net
struct cipso_v4_doi
struct in_ifaddr
struct in_device
rt->u.dst
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
---
net/core/neighbour.c | 2 --
net/core/net_namespace.c | 2 --
net/ipv4/cipso_ipv4.c | 1 -
net/ipv4/devinet.c | 9 +--------
net/ipv4/route.c | 1 -
5 files changed, 1 insertion(+), 14 deletions(-)
--- a/net/core/neighbour.c
+++ b/net/core/neighbour.c
@@ -1340,7 +1340,6 @@ struct neigh_parms *neigh_parms_alloc(struct net_device *dev,
if (p) {
p->tbl = tbl;
atomic_set(&p->refcnt, 1);
- INIT_RCU_HEAD(&p->rcu_head);
p->reachable_time =
neigh_rand_reach_time(p->base_reachable_time);
@@ -1412,7 +1411,6 @@ void neigh_table_init_no_netlink(struct neigh_table *tbl)
tbl->parms.net = &init_net;
#endif
atomic_set(&tbl->parms.refcnt, 1);
- INIT_RCU_HEAD(&tbl->parms.rcu_head);
tbl->parms.reachable_time =
neigh_rand_reach_time(tbl->parms.base_reachable_time);
--- a/net/core/net_namespace.c
+++ b/net/core/net_namespace.c
@@ -47,7 +47,6 @@ static __net_init int setup_net(struct net *net)
goto out;
ng->len = INITIAL_NET_GEN_PTRS;
- INIT_RCU_HEAD(&ng->rcu);
rcu_assign_pointer(net->gen, ng);
error = 0;
@@ -446,7 +445,6 @@ int net_assign_generic(struct net *net, int id, void *data)
*/
ng->len = id;
- INIT_RCU_HEAD(&ng->rcu);
memcpy(&ng->ptr, &old_ng->ptr, old_ng->len);
rcu_assign_pointer(net->gen, ng);
--- a/net/ipv4/cipso_ipv4.c
+++ b/net/ipv4/cipso_ipv4.c
@@ -490,7 +490,6 @@ int cipso_v4_doi_add(struct cipso_v4_doi *doi_def)
}
atomic_set(&doi_def->refcount, 1);
- INIT_RCU_HEAD(&doi_def->rcu);
spin_lock(&cipso_v4_doi_list_lock);
if (cipso_v4_doi_search(doi_def->doi) != NULL)
--- a/net/ipv4/devinet.c
+++ b/net/ipv4/devinet.c
@@ -112,13 +112,7 @@ static inline void devinet_sysctl_unregister(struct in_device *idev)
static struct in_ifaddr *inet_alloc_ifa(void)
{
- struct in_ifaddr *ifa = kzalloc(sizeof(*ifa), GFP_KERNEL);
-
- if (ifa) {
- INIT_RCU_HEAD(&ifa->rcu_head);
- }
-
- return ifa;
+ return kzalloc(sizeof(struct in_ifaddr), GFP_KERNEL);
}
static void inet_rcu_free_ifa(struct rcu_head *head)
@@ -161,7 +155,6 @@ static struct in_device *inetdev_init(struct net_device *dev)
in_dev = kzalloc(sizeof(*in_dev), GFP_KERNEL);
if (!in_dev)
goto out;
- INIT_RCU_HEAD(&in_dev->rcu_head);
memcpy(&in_dev->cnf, dev_net(dev)->ipv4.devconf_dflt,
sizeof(in_dev->cnf));
in_dev->cnf.sysctl = NULL;
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -1386,7 +1386,6 @@ void ip_rt_redirect(__be32 old_gw, __be32 daddr, __be32 new_gw,
/* Copy all the information. */
*rt = *rth;
- INIT_RCU_HEAD(&rt->u.dst.rcu_head);
rt->u.dst.__use = 1;
atomic_set(&rt->u.dst.__refcnt, 1);
rt->u.dst.child = NULL;
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH] net: don't use INIT_RCU_HEAD
2008-10-28 13:31 [PATCH] net: don't use INIT_RCU_HEAD Alexey Dobriyan
@ 2008-10-28 15:29 ` Patrick McHardy
2008-10-28 15:43 ` Alexey Dobriyan
2008-10-28 16:10 ` Paul E. McKenney
1 sibling, 1 reply; 6+ messages in thread
From: Patrick McHardy @ 2008-10-28 15:29 UTC (permalink / raw)
To: Alexey Dobriyan; +Cc: davem, netdev
Alexey Dobriyan wrote:
> call_rcu() will unconditionally rewrite RCU head anyway.
> Applies to
> struct neigh_parms
> struct neigh_table
> struct net
> struct cipso_v4_doi
> struct in_ifaddr
> struct in_device
> rt->u.dst
It would probably make sense to get a statement from Paul
whether this might be required in the future, f.i. for some
debugging feature.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] net: don't use INIT_RCU_HEAD
2008-10-28 15:29 ` Patrick McHardy
@ 2008-10-28 15:43 ` Alexey Dobriyan
2008-10-28 16:05 ` Paul E. McKenney
0 siblings, 1 reply; 6+ messages in thread
From: Alexey Dobriyan @ 2008-10-28 15:43 UTC (permalink / raw)
To: Patrick McHardy; +Cc: davem, netdev, paulmck
On Tue, Oct 28, 2008 at 04:29:06PM +0100, Patrick McHardy wrote:
> Alexey Dobriyan wrote:
>> call_rcu() will unconditionally rewrite RCU head anyway.
>> Applies to struct neigh_parms
>> struct neigh_table
>> struct net
>> struct cipso_v4_doi
>> struct in_ifaddr
>> struct in_device
>> rt->u.dst
>
> It would probably make sense to get a statement from Paul
> whether this might be required in the future, f.i. for some
> debugging feature.
Let's cc him :-)
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] net: don't use INIT_RCU_HEAD
2008-10-28 15:43 ` Alexey Dobriyan
@ 2008-10-28 16:05 ` Paul E. McKenney
0 siblings, 0 replies; 6+ messages in thread
From: Paul E. McKenney @ 2008-10-28 16:05 UTC (permalink / raw)
To: Alexey Dobriyan; +Cc: Patrick McHardy, davem, netdev
On Tue, Oct 28, 2008 at 06:43:41PM +0300, Alexey Dobriyan wrote:
> On Tue, Oct 28, 2008 at 04:29:06PM +0100, Patrick McHardy wrote:
> > Alexey Dobriyan wrote:
> >> call_rcu() will unconditionally rewrite RCU head anyway.
> >> Applies to struct neigh_parms
> >> struct neigh_table
> >> struct net
> >> struct cipso_v4_doi
> >> struct in_ifaddr
> >> struct in_device
> >> rt->u.dst
> >
> > It would probably make sense to get a statement from Paul
> > whether this might be required in the future, f.i. for some
> > debugging feature.
>
> Let's cc him :-)
Can't say that I would be all that upset if INIT_RCU_HEAD() were to
simply vanish. So I have no problem with it being removed from the
above functions.
Suppose I might as well find the original and Ack it. ;-)
Thanx, Paul
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] net: don't use INIT_RCU_HEAD
2008-10-28 13:31 [PATCH] net: don't use INIT_RCU_HEAD Alexey Dobriyan
2008-10-28 15:29 ` Patrick McHardy
@ 2008-10-28 16:10 ` Paul E. McKenney
2008-10-28 20:25 ` David Miller
1 sibling, 1 reply; 6+ messages in thread
From: Paul E. McKenney @ 2008-10-28 16:10 UTC (permalink / raw)
To: Alexey Dobriyan; +Cc: davem, netdev
On Tue, Oct 28, 2008 at 04:31:24PM +0300, Alexey Dobriyan wrote:
> call_rcu() will unconditionally rewrite RCU head anyway.
> Applies to
> struct neigh_parms
> struct neigh_table
> struct net
> struct cipso_v4_doi
> struct in_ifaddr
> struct in_device
> rt->u.dst
Assuming that no code outside of RCU is testing the rcu_head fields...
That would usually be a bad idea in any case, as call_rcu() makes no
guarantee about the values of these fields after the callback is invoked.
Furthermore, there have been serious proposals that would change the
call_rcu() field names and layout.
Therefore:
Acked-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
> Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
> ---
>
> net/core/neighbour.c | 2 --
> net/core/net_namespace.c | 2 --
> net/ipv4/cipso_ipv4.c | 1 -
> net/ipv4/devinet.c | 9 +--------
> net/ipv4/route.c | 1 -
> 5 files changed, 1 insertion(+), 14 deletions(-)
>
> --- a/net/core/neighbour.c
> +++ b/net/core/neighbour.c
> @@ -1340,7 +1340,6 @@ struct neigh_parms *neigh_parms_alloc(struct net_device *dev,
> if (p) {
> p->tbl = tbl;
> atomic_set(&p->refcnt, 1);
> - INIT_RCU_HEAD(&p->rcu_head);
> p->reachable_time =
> neigh_rand_reach_time(p->base_reachable_time);
>
> @@ -1412,7 +1411,6 @@ void neigh_table_init_no_netlink(struct neigh_table *tbl)
> tbl->parms.net = &init_net;
> #endif
> atomic_set(&tbl->parms.refcnt, 1);
> - INIT_RCU_HEAD(&tbl->parms.rcu_head);
> tbl->parms.reachable_time =
> neigh_rand_reach_time(tbl->parms.base_reachable_time);
>
> --- a/net/core/net_namespace.c
> +++ b/net/core/net_namespace.c
> @@ -47,7 +47,6 @@ static __net_init int setup_net(struct net *net)
> goto out;
>
> ng->len = INITIAL_NET_GEN_PTRS;
> - INIT_RCU_HEAD(&ng->rcu);
> rcu_assign_pointer(net->gen, ng);
>
> error = 0;
> @@ -446,7 +445,6 @@ int net_assign_generic(struct net *net, int id, void *data)
> */
>
> ng->len = id;
> - INIT_RCU_HEAD(&ng->rcu);
> memcpy(&ng->ptr, &old_ng->ptr, old_ng->len);
>
> rcu_assign_pointer(net->gen, ng);
> --- a/net/ipv4/cipso_ipv4.c
> +++ b/net/ipv4/cipso_ipv4.c
> @@ -490,7 +490,6 @@ int cipso_v4_doi_add(struct cipso_v4_doi *doi_def)
> }
>
> atomic_set(&doi_def->refcount, 1);
> - INIT_RCU_HEAD(&doi_def->rcu);
>
> spin_lock(&cipso_v4_doi_list_lock);
> if (cipso_v4_doi_search(doi_def->doi) != NULL)
> --- a/net/ipv4/devinet.c
> +++ b/net/ipv4/devinet.c
> @@ -112,13 +112,7 @@ static inline void devinet_sysctl_unregister(struct in_device *idev)
>
> static struct in_ifaddr *inet_alloc_ifa(void)
> {
> - struct in_ifaddr *ifa = kzalloc(sizeof(*ifa), GFP_KERNEL);
> -
> - if (ifa) {
> - INIT_RCU_HEAD(&ifa->rcu_head);
> - }
> -
> - return ifa;
> + return kzalloc(sizeof(struct in_ifaddr), GFP_KERNEL);
> }
>
> static void inet_rcu_free_ifa(struct rcu_head *head)
> @@ -161,7 +155,6 @@ static struct in_device *inetdev_init(struct net_device *dev)
> in_dev = kzalloc(sizeof(*in_dev), GFP_KERNEL);
> if (!in_dev)
> goto out;
> - INIT_RCU_HEAD(&in_dev->rcu_head);
> memcpy(&in_dev->cnf, dev_net(dev)->ipv4.devconf_dflt,
> sizeof(in_dev->cnf));
> in_dev->cnf.sysctl = NULL;
> --- a/net/ipv4/route.c
> +++ b/net/ipv4/route.c
> @@ -1386,7 +1386,6 @@ void ip_rt_redirect(__be32 old_gw, __be32 daddr, __be32 new_gw,
>
> /* Copy all the information. */
> *rt = *rth;
> - INIT_RCU_HEAD(&rt->u.dst.rcu_head);
> rt->u.dst.__use = 1;
> atomic_set(&rt->u.dst.__refcnt, 1);
> rt->u.dst.child = NULL;
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH] net: don't use INIT_RCU_HEAD
2008-10-28 16:10 ` Paul E. McKenney
@ 2008-10-28 20:25 ` David Miller
0 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2008-10-28 20:25 UTC (permalink / raw)
To: paulmck; +Cc: adobriyan, netdev
From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
Date: Tue, 28 Oct 2008 09:10:17 -0700
> On Tue, Oct 28, 2008 at 04:31:24PM +0300, Alexey Dobriyan wrote:
> > call_rcu() will unconditionally rewrite RCU head anyway.
> > Applies to
> > struct neigh_parms
> > struct neigh_table
> > struct net
> > struct cipso_v4_doi
> > struct in_ifaddr
> > struct in_device
> > rt->u.dst
>
> Assuming that no code outside of RCU is testing the rcu_head fields...
> That would usually be a bad idea in any case, as call_rcu() makes no
> guarantee about the values of these fields after the callback is invoked.
> Furthermore, there have been serious proposals that would change the
> call_rcu() field names and layout.
>
> Therefore:
>
> Acked-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
I've applied this patch, thanks everyone.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2008-10-28 20:25 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-10-28 13:31 [PATCH] net: don't use INIT_RCU_HEAD Alexey Dobriyan
2008-10-28 15:29 ` Patrick McHardy
2008-10-28 15:43 ` Alexey Dobriyan
2008-10-28 16:05 ` Paul E. McKenney
2008-10-28 16:10 ` Paul E. McKenney
2008-10-28 20:25 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).