[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20141123004704.GA2245@kernel.org>
Date: Sat, 22 Nov 2014 16:47:04 -0800
From: Shaohua Li <shli@...nel.org>
To: Tejun Heo <tj@...nel.org>
Cc: linux-kernel@...r.kernel.org, Jens Axboe <axboe@...com>,
Kent Overstreet <kmo@...erainc.com>
Subject: Re: [PATCH percpu/for-3.18-fixes] percpu-ref: fix DEAD flag
contamination of percpu pointer
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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists