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