[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20181018091250.GA18839@dhcp22.suse.cz>
Date: Thu, 18 Oct 2018 11:12:50 +0200
From: Michal Hocko <mhocko@...nel.org>
To: Kirill Tkhai <ktkhai@...tuozzo.com>
Cc: Andrea Parri <andrea.parri@...rulasolutions.com>,
akpm@...ux-foundation.org, hannes@...xchg.org,
vdavydov.dev@...il.com, linux-kernel@...r.kernel.org,
linux-mm@...ck.org
Subject: Re: [PATCH] mm: Convert mem_cgroup_id::ref to refcount_t type
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
Powered by blists - more mailing lists