Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp4892038imm; Tue, 31 Jul 2018 01:46:27 -0700 (PDT) X-Google-Smtp-Source: AAOMgpf+6NtYRKfIjwaVNQsTQfpPe++Nei3wH8UmiaSHEcNSsAfX8utIlarG5SUAX8JXE+igv3QU X-Received: by 2002:a17:902:758b:: with SMTP id j11-v6mr1188889pll.29.1533026787568; Tue, 31 Jul 2018 01:46:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533026787; cv=none; d=google.com; s=arc-20160816; b=c0xjKymmoKoZV/3i1+YRiLKau2mNQcUe1KY2XDj+sQIDC5d7QPGHLKu9NbOL+2YBdw Iah586xdpbbeTggMRzlkNlrUaaDUfi1OMmzSH+8aV68aRlavhRWRh9erZ7+hOj5f9dCJ JfWR/o9SCf2YFzx2h5ODf//7GA/vUyev5w/53qqwaeTZiBtXZUs9KFD+v9v+i0SzX2Am 63LinBkWKyIrMf9I/FfsVMDYgfCBQvnNmMnZfjePLrOnmdOdROg5DnQj1v28Su+MMaxI JihwiENAfI9n0KH+MVW4zszLOY+RghPh5jf7HR/wlQY4xwwI4yWqAzY4AEDpFhQ1crKr LJxw== 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:arc-authentication-results; bh=hmBHkFF0YVxeku7qxrPYFrDY38/Af/ZUMsvpgTZlJXE=; b=iN1MH+HIgVugkKAvtAI7yy/07KBElnr3F6JByaQ8MdW/qe5a1UDHhd3f0ul3iqqXLS uUWf0DaKi1d+NffQr5/zeUuoDVU4ZUC34hvFuX7qxTsVlPdGkAXrFTjq6TBYBwtKEL7/ 4gkPR/US7wHfR3wfevdmpEbseDxMwbFA5JNggX2CBK9pNhFFOsOUfNVux4qSflvZfayR bWuBaODUeWo3hM31ksOTVyhPuLvMX+aW6CNtPAvcw06DiGwv0aOR50mtqrmOkkoC+akH eDf15fCUiwMO5Y2BjyNIp7KfSh4qFQ95UHshnes1kAN4zsOEMhcRYIfjicf3RdQSOHjb Z0ug== 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 a20-v6si12704771pls.237.2018.07.31.01.46.13; Tue, 31 Jul 2018 01:46:27 -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 S1731827AbeGaKY1 (ORCPT + 99 others); Tue, 31 Jul 2018 06:24:27 -0400 Received: from mx2.suse.de ([195.135.220.15]:46690 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1731364AbeGaKY1 (ORCPT ); Tue, 31 Jul 2018 06:24:27 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 83903B00D; Tue, 31 Jul 2018 08:45:10 +0000 (UTC) Date: Tue, 31 Jul 2018 10:45:09 +0200 From: Michal Hocko To: Roman Gushchin Cc: linux-mm@kvack.org, Johannes Weiner , David Rientjes , Tetsuo Handa , Tejun Heo , kernel-team@fb.com, linux-kernel@vger.kernel.org, Shakeel Butt , Andrew Morton , Stephen Rothwell Subject: Re: [PATCH 1/3] mm: introduce mem_cgroup_put() helper Message-ID: <20180731084509.GE4557@dhcp22.suse.cz> References: <20180730180100.25079-1-guro@fb.com> <20180730180100.25079-2-guro@fb.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180730180100.25079-2-guro@fb.com> 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 Mon 30-07-18 11:00:58, Roman Gushchin wrote: > Introduce the mem_cgroup_put() helper, which helps to eliminate guarding > memcg css release with "#ifdef CONFIG_MEMCG" in multiple places. Is there any reason for this to be a separate patch? I usually do not like to add helpers without their users because this makes review harder. This one is quite trivial to fit into Patch3 easilly. > Link: http://lkml.kernel.org/r/20180623000600.5818-2-guro@fb.com > Signed-off-by: Roman Gushchin > Reviewed-by: Shakeel Butt > Reviewed-by: Andrew Morton > Cc: Shakeel Butt > Cc: Johannes Weiner > Cc: Michal Hocko > Signed-off-by: Andrew Morton > Signed-off-by: Stephen Rothwell > --- > include/linux/memcontrol.h | 9 +++++++++ > 1 file changed, 9 insertions(+) > > diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h > index 6c6fb116e925..e53e00cdbe3f 100644 > --- a/include/linux/memcontrol.h > +++ b/include/linux/memcontrol.h > @@ -375,6 +375,11 @@ struct mem_cgroup *mem_cgroup_from_css(struct cgroup_subsys_state *css){ > return css ? container_of(css, struct mem_cgroup, css) : NULL; > } > > +static inline void mem_cgroup_put(struct mem_cgroup *memcg) > +{ > + css_put(&memcg->css); > +} > + > #define mem_cgroup_from_counter(counter, member) \ > container_of(counter, struct mem_cgroup, member) > > @@ -837,6 +842,10 @@ static inline bool task_in_mem_cgroup(struct task_struct *task, > return true; > } > > +static inline void mem_cgroup_put(struct mem_cgroup *memcg) > +{ > +} > + > static inline struct mem_cgroup * > mem_cgroup_iter(struct mem_cgroup *root, > struct mem_cgroup *prev, > -- > 2.14.4 > -- Michal Hocko SUSE Labs