All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nick Piggin <npiggin@suse.de>
To: Eric Dumazet <eric.dumazet@gmail.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
	Rusty Russell <rusty@rustcorp.com.au>,
	Nick Piggin <npiggin@gmail.com>,
	linux-kernel@vger.kernel.org,
	Jon Masters <jonathan@jonmasters.org>
Subject: Re: Is module refcounting racy?
Date: Tue, 6 Apr 2010 17:38:18 +1000	[thread overview]
Message-ID: <20100406073818.GE11191@laptop> (raw)
In-Reply-To: <1270534763.9013.55.camel@edumazet-laptop>

On Tue, Apr 06, 2010 at 08:19:23AM +0200, Eric Dumazet wrote:
> Le mardi 06 avril 2010 à 15:05 +1000, Nick Piggin a écrit :
> 
> > Also if anyone else is looking at a way to do _really_ scalable
> > refcounting elsewhere, this could be a good template (I certainly looked
> > here first when trying to get ideas for vfsmount refcounting).
> 
> Yes, nice trick Nick, I was thinking about it for network code :)
> 
> Acked-by: Eric Dumazet <eric.dumazet@gmail.com>
> 
> I confess the smp_wmb() in module_put() bothered me a bit until I saw it
> was only a barrier() on X86 (if !CONFIG_X86_OOSTORE)

Yep. smp_wmb() and smp_rmb() are both noops on x86 (OOSTORE is some
really obscure thing that we don't need to worry about really). On
POWER6/7 CPUs, it uses lwsync which is fairly cheap as well.

I think refcounting in _general_ needs a smp_wmb() (or, to be more
precise, probably a release barrier) before decrements because you don't
want previous futzing with the object to leak into after a final
decrement may be observed by another CPU. So it might be hard to avoid
anyway.


      reply	other threads:[~2010-04-06  7:38 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-18 10:55 Is module refcounting racy? Nick Piggin
2010-03-29  9:12 ` Rusty Russell
2010-03-29 16:58   ` Nick Piggin
2010-03-31  3:44     ` Rusty Russell
2010-04-01  8:09       ` Nick Piggin
2010-04-01 15:55         ` Linus Torvalds
2010-04-06  2:39           ` Rusty Russell
2010-04-06  5:05           ` Nick Piggin
2010-04-06  6:19             ` Eric Dumazet
2010-04-06  7:38               ` Nick Piggin [this message]

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=20100406073818.GE11191@laptop \
    --to=npiggin@suse.de \
    --cc=eric.dumazet@gmail.com \
    --cc=jonathan@jonmasters.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=npiggin@gmail.com \
    --cc=rusty@rustcorp.com.au \
    --cc=torvalds@linux-foundation.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.