Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp1676685imm; Thu, 18 Oct 2018 02:13:39 -0700 (PDT) X-Google-Smtp-Source: ACcGV62YYxvCsj1piPf8LeF0lDEEsYnXhhzTK4yURAhIaNFlhvD6B3E1JK8s0IJAlMMMobKq/c/S X-Received: by 2002:a17:902:8bc3:: with SMTP id r3-v6mr28975018plo.218.1539854018960; Thu, 18 Oct 2018 02:13:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539854018; cv=none; d=google.com; s=arc-20160816; b=p8u+mcyBMPS8ckDf35aVEncBdNYAiqPCGOCl/feCYWUYNJTie+XOjR8jkEf4BlhffK lMTn98tbkZktIzyZWasDQnb9VJP1jNXw9o46+HJ/V9ui430XFyz5mMcoTVYcjOOvtftb H+so0MC5IHNl4yKXgh2KnU7xSdQToDjgkYBW3nR0P9YXGQ1GvD7fNQZv1CfiX5kCwogs aZiC1T7ljJZHzxKYzHlsMe5kxyvrSY/63vXBJrus/9neXNsWXVqVX2PQGgjXsU5KHN+o 1Xvvhhg6K3YtbWAD+UL3PftX9iqUbpOie1IpqK4qUlmZ/74BTfMAoIkO21e78TOF6F2Z Zn1Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=OojPXZNsIyqliFJkaT/fC4odYshyGIrK2tul3wB4dYI=; b=Ts236aiHDrLnygs5vB0JUtkH/ObJu//+hrnAMHzc3YQLf18qQEikKhRNAq9hkfXv3T 7mOEFh/Wd6R/9+7iI4NRKMz9K+2qE9snEVxrm3Fc9QWv18PK2j56dkg7GKjk3DX23rht esaGkua2Oy+w2aWrLh04QkimFjytISVGQId5IY8juTjd3vy5HSbU6QD+KzZROuxoRvIB Vx3gqKjY4R2TwetyUGZOSVIlbcZP11Y/UdIoQ6dNiO5sVPg3eG08fO/OEyCI4wLFQQId ycRW32FbXO4zCNjg+dyw1m9Xr7yN/4kLGv7p4mxrYuJ2DXsa9fudLj0g/JUAk9VBliT7 7DwQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i1-v6si18908993pfo.189.2018.10.18.02.13.23; Thu, 18 Oct 2018 02:13:38 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727836AbeJRRM5 (ORCPT + 99 others); Thu, 18 Oct 2018 13:12:57 -0400 Received: from mx2.suse.de ([195.135.220.15]:53502 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727363AbeJRRM5 (ORCPT ); Thu, 18 Oct 2018 13:12:57 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 8EDCCAD8E; Thu, 18 Oct 2018 09:12:51 +0000 (UTC) Date: Thu, 18 Oct 2018 11:12:50 +0200 From: Michal Hocko To: Kirill Tkhai Cc: Andrea Parri , 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 Message-ID: <20181018091250.GA18839@dhcp22.suse.cz> References: <153910718919.7006.13400779039257185427.stgit@localhost.localdomain> <20181016124939.GA13278@andrea> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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