From: Michal Hocko <mhocko@kernel.org>
To: Kirill Tkhai <ktkhai@virtuozzo.com>
Cc: Andrea Parri <andrea.parri@amarulasolutions.com>,
akpm@linux-foundation.org, hannes@cmpxchg.org,
vdavydov.dev@gmail.com, linux-kernel@vger.kernel.org,
linux-mm@kvack.org
Subject: Re: [PATCH] mm: Convert mem_cgroup_id::ref to refcount_t type
Date: Thu, 18 Oct 2018 11:12:50 +0200 [thread overview]
Message-ID: <20181018091250.GA18839@dhcp22.suse.cz> (raw)
In-Reply-To: <a990eed4-611b-8464-c2aa-56684fee0ee5@virtuozzo.com>
On Tue 16-10-18 16:19:40, Kirill Tkhai wrote:
> Hi, Andrea,
>
> On 16.10.2018 15:49, Andrea Parri wrote:
> > Hi Kirill,
> >
> > On Tue, Oct 09, 2018 at 08:46:56PM +0300, Kirill Tkhai wrote:
> >> This will allow to use generic refcount_t interfaces
> >> to check counters overflow instead of currently existing
> >> VM_BUG_ON(). The only difference after the patch is
> >> VM_BUG_ON() may cause BUG(), while refcount_t fires
> >> with WARN().
> >
> > refcount_{sub_and_test,inc_not_zero}() are documented to provide
> > "slightly" more relaxed ordering than their atomic_* counterpart,
> > c.f.,
> >
> > Documentation/core-api/refcount-vs-atomic.rst
> > lib/refcount.c (inline comments)
> >
> > IIUC, this semantic change won't cause problems here (but please
> > double-check? ;D ).
>
> I just don't see a place, where we may think about using a modification
> of struct mem_cgroup::id::ref as a memory barrier to order something,
> and all this looks safe for me.
If there was any it would surely be unintentional. memcg->id.ref is a clear
reference counter pattern for the id lifetime.
--
Michal Hocko
SUSE Labs
prev parent reply other threads:[~2018-10-18 9:12 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-09 17:46 Kirill Tkhai
2018-10-16 12:05 ` Michal Hocko
2018-10-16 12:49 ` Andrea Parri
2018-10-16 13:19 ` Kirill Tkhai
2018-10-18 9:12 ` Michal Hocko [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=20181018091250.GA18839@dhcp22.suse.cz \
--to=mhocko@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=andrea.parri@amarulasolutions.com \
--cc=hannes@cmpxchg.org \
--cc=ktkhai@virtuozzo.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=vdavydov.dev@gmail.com \
/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