public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Eric Dumazet <eric.dumazet@gmail.com>
To: David Miller <davem@davemloft.net>
Cc: netdev@vger.kernel.org
Subject: [PATCH net-next-2.6] inetpeer: should use call_rcu() variant
Date: Mon, 14 Mar 2011 05:15:31 +0100	[thread overview]
Message-ID: <1300076131.2761.61.camel@edumazet-laptop> (raw)
In-Reply-To: <20110313.164215.193721466.davem@davemloft.net>

Le dimanche 13 mars 2011 à 16:42 -0700, David Miller a écrit :
> From: Eric Dumazet <eric.dumazet@gmail.com>
> Date: Sun, 13 Mar 2011 11:04:09 +0100
> 
> > David, I am not sure this is safe, since we use call_rcu_bh() when
> > freeing one item. One cpu could decide to kfree() one item while another
> > cpu could still use it.
> > 
> > rcu_read_lock_bh() was signalling to others cpu we were in a softirq
> > section, so we were delaying a possible kfree().
> 
> Ok, could we use normal call_rcu() to solve this then?

Yes, this should be good.

Thanks

[PATCH net-next-2.6] inetpeer: should use call_rcu() variant

After commit 7b46ac4e77f3224a (inetpeer: Don't disable BH for initial
fast RCU lookup.), we should use call_rcu() to wait proper RCU grace
period.

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
---
 net/ipv4/inetpeer.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/ipv4/inetpeer.c b/net/ipv4/inetpeer.c
index 86b1d08..dd1b20e 100644
--- a/net/ipv4/inetpeer.c
+++ b/net/ipv4/inetpeer.c
@@ -399,7 +399,7 @@ static void unlink_from_pool(struct inet_peer *p, struct inet_peer_base *base)
 	write_sequnlock_bh(&base->lock);
 
 	if (do_free)
-		call_rcu_bh(&p->rcu, inetpeer_free_rcu);
+		call_rcu(&p->rcu, inetpeer_free_rcu);
 	else
 		/* The node is used again.  Decrease the reference counter
 		 * back.  The loop "cleanup -> unlink_from_unused



  reply	other threads:[~2011-03-14  4:15 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-08 22:59 [PATCH] inetpeer: Don't disable BH for initial fast RCU lookup David Miller
2011-03-13 10:04 ` Eric Dumazet
2011-03-13 23:42   ` David Miller
2011-03-14  4:15     ` Eric Dumazet [this message]
2011-03-14  6:22       ` [PATCH net-next-2.6] inetpeer: should use call_rcu() variant David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1300076131.2761.61.camel@edumazet-laptop \
    --to=eric.dumazet@gmail.com \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox