linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Shaohua Li <shli@kernel.org>
To: Tejun Heo <tj@kernel.org>
Cc: linux-kernel@vger.kernel.org, Jens Axboe <axboe@fb.com>,
	Kent Overstreet <kmo@daterainc.com>
Subject: Re: [PATCH percpu/for-3.18-fixes] percpu-ref: fix DEAD flag contamination of percpu pointer
Date: Sat, 22 Nov 2014 16:47:04 -0800	[thread overview]
Message-ID: <20141123004704.GA2245@kernel.org> (raw)
In-Reply-To: <20141122170602.GE26007@htj.dyndns.org>

On Sat, Nov 22, 2014 at 12:06:02PM -0500, Tejun Heo wrote:
> On Sat, Nov 22, 2014 at 09:04:48AM -0800, Shaohua Li wrote:
> ...
> > > +	/*
> > > +	 * Theoretically, the following could test just ATOMIC; however,
> > > +	 * then we'd have to mask off DEAD separately as DEAD may be
> > > +	 * visible without ATOMIC if we race with percpu_ref_kill().  DEAD
> > > +	 * implies ATOMIC anyway.  Test them together.
> > > +	 */
> > > +	if (unlikely(percpu_ptr & __PERCPU_REF_ATOMIC_DEAD))
> > >  		return false;
> > 
> > this sounds not the correct answer. the DEAD/ATOMIC bit can be set by
> > percpu_ref_kill() right after the check.
> 
> Yes, but that's why we're fetching @percpu_ptr with ACCESS_ONCE()
> before checking the flags.

Ok, I forgot we cache the percpu_ptr. Yes, this does work. You can add my
signed-off in the patch.

Thanks,
Shaohua

  reply	other threads:[~2014-11-23  0:47 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-22  6:48 [PATCH] percpu-ref: correctly get percpu pointer Shaohua Li
2014-11-22 14:22 ` [PATCH percpu/for-3.18-fixes] percpu-ref: fix DEAD flag contamination of " Tejun Heo
2014-11-22 17:04   ` Shaohua Li
2014-11-22 17:06     ` Tejun Heo
2014-11-23  0:47       ` Shaohua Li [this message]
2014-11-23 17:48   ` Tejun Heo

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=20141123004704.GA2245@kernel.org \
    --to=shli@kernel.org \
    --cc=axboe@fb.com \
    --cc=kmo@daterainc.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tj@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;
as well as URLs for NNTP newsgroup(s).