[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20191016153234.GO18794@devbig004.ftw2.facebook.com>
Date: Wed, 16 Oct 2019 08:32:34 -0700
From: Tejun Heo <tj@...nel.org>
To: Aleksa Sarai <cyphar@...har.com>
Cc: Li Zefan <lizefan@...wei.com>,
Johannes Weiner <hannes@...xchg.org>, cgroups@...r.kernel.org,
linux-kernel@...r.kernel.org, stable@...r.kernel.org
Subject: Re: [PATCH] cgroup: pids: use {READ,WRITE}_ONCE for pids->limit
operations
Hello,
On Thu, Oct 17, 2019 at 02:29:46AM +1100, Aleksa Sarai wrote:
> > Hah, where is it saying that?
>
> Isn't that what this says:
>
> > Therefore, if you find yourself only using the Non-RMW operations of
> > atomic_t, you do not in fact need atomic_t at all and are doing it
> > wrong.
>
> Doesn't using just atomic64_read() and atomic64_set() fall under "only
> using the non-RMW operations of atomic_t"? But yes, I agree that any
> locking is overkill.
Yeah, I mean, it's an overkill. We can use seqlock or u64_stat here
but it doesn't matter that much.
> > > As for 64-bit on 32-bit machines -- that is a separate issue, but from
> > > [1] it seems to me like there are more problems that *_ONCE() fixes than
> > > just split reads and writes.
> >
> > Your explanations are too wishy washy. If you wanna fix it, please do
> > it correctly. R/W ONCE isn't the right solution here.
>
> Sure, I will switch it to use atomic64_read() and atomic64_set() instead
> if that's what you'd prefer. Though I will mention that on quite a few
> architectures atomic64_read() is defined as:
>
> #define atomic64_read(v) READ_ONCE((v)->counter)
Yeah, on archs which don't have split access on 64bits. On the ones
which do, it does something else. The generic implementation is
straight-up locking, I think.
Thanks.
--
tejun
Powered by blists - more mailing lists