Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp5254413imm; Tue, 31 Jul 2018 07:59:51 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfTrzOQfoyUAuG28pXLBcOhlPcC1Vaqize7/0BMXgBn18x10NShFEykNeI4UZNCboGLjbjo X-Received: by 2002:a65:62cd:: with SMTP id m13-v6mr20705185pgv.280.1533049191771; Tue, 31 Jul 2018 07:59:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533049191; cv=none; d=google.com; s=arc-20160816; b=X2LhYDWQgzSnG84qP4r5RU0dDvJiuaa4MR9C1Z5oXHfFbuM/0DLzICM0S/2RsPSrbS gFsjkRiUFRrjL1KDQiXlrPm8G3GVd0EsUp0O0QFhn853Ufz1et1gy9r1CxhwsilKg3HE 1wxW3mRLmcd4HWVat/KFqxWNQOtPCdGS+n6+QCwQHvjV8UVQhpCRxODcrdDv15hVuoMp oghOzi2D4/skTCK50V5RP23JsoENbMDRSpvNFiNzWzwvUXrgWqZtj20cXwlX6CkSuxeq kOjtX61BP/ORZn4Euwrr2cKCUsSkviC95hXlOp1bkMnNgDtAEqbs+eOH2xBQ9o6p6uJF kwyA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature :arc-authentication-results; bh=9WPjz4ZAXqi3j8IMmVRI4g0N/TxCqLpc/2GFPRLhFTc=; b=J/ltTug9vi0+4ZEMD1l28Irf8MwRkt4HaTKDozzFcGSsZriWz/hV7eYtXePzXjcN0v MOWanvZ7wVxth4YMeOY7wia/rL9Pq7NUfvMUMkJSPbEfRonC9/WpK/D1hNmhxJ4MtNo9 +sgG1Vm8zh0AKHeQ/0BSLjVrz+Zkq8KynUzILagsuNTfyh5ANE1DJHfOcx0TtSqtL0Ln l2f0/jGpaxp+SMsOZCfxtJj7NKNSMoxwHDK4l1bkcXaFaIYg+ZsxseiUixLhSSjrJhh3 NdE/FKklGbBCF9R9qlJLXSnuTv86LmIq3fxJHeLjv58TOTHbg637cWB2upLBHZ/pqLiL bOtw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=YOAHYQJw; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p15-v6si12011714pgv.525.2018.07.31.07.59.37; Tue, 31 Jul 2018 07:59:51 -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; dkim=pass header.i=@google.com header.s=20161025 header.b=YOAHYQJw; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732443AbeGaQi4 (ORCPT + 99 others); Tue, 31 Jul 2018 12:38:56 -0400 Received: from mail-wr1-f65.google.com ([209.85.221.65]:37544 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732371AbeGaQi4 (ORCPT ); Tue, 31 Jul 2018 12:38:56 -0400 Received: by mail-wr1-f65.google.com with SMTP id q10-v6so17002975wrd.4 for ; Tue, 31 Jul 2018 07:58:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=9WPjz4ZAXqi3j8IMmVRI4g0N/TxCqLpc/2GFPRLhFTc=; b=YOAHYQJwv/EkWDPkKcoansdSwL0xGJ8wHS4GZPCR5dZayAf+nAhd0lINBsunLkt5ML VMCbndQkE7ZSH16gMoKg9jEm0Xef6FNQSF+G6dmT6tlb4sNxkzevqj3InHGWXyJUZJ/l dkDdDH5PFJzedSsSRBR3EPoRzunrhulr9AcrxXaLNufJOEPkORZIrk9xyNAV+yIG12b7 QcnRTYL1EnHgSyKcUOEN7ofiPI+S7Xl7WpMFM9C7O/pIVr5PDvZkNAaMzkl455OCxiE0 nLBICwNdZi+xn2W2gkPZLiCtJyXfXJBwydPWhjyqAXubuuHbTOFoQqcpLa4nz0n5hBak aDfg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=9WPjz4ZAXqi3j8IMmVRI4g0N/TxCqLpc/2GFPRLhFTc=; b=PiLKjWHuZsHGwpIb/+xWObggvHlrgbMP83w10QMr9dXiiPWSXVL4bFRdWdHbToIzlW 2lglNRJyQiqn6cXMiADS8bu2eYQR+Slkf9u+oeY+NwhQjSGLrTXKE/VCN4vnUGOPPOye pLJzAi8xCSqphkbqqCXrlGyi0DEyX/yATaFaIXCSsp1rLdKckXVGvWjClyCwWocISIjD ZLcBxLdXvCDwiNvAGV7IkmnoeQlODn0o1CUm/sUyuxJ49T5fS/8cpb/U2qIfzFpS7NXn Fxzx9M/u7M24OKAW5O8HdP/8a/xxooZ21MK1lINX1EtxYVLjO4SDVOyrKT+ysfL+CNP3 9WXg== X-Gm-Message-State: AOUpUlG4nw5zI+IjOySeQiNKJmEddoDg4/Y5Ntkq1SIoCBlXhykuEC8s OduBkOUFe7Jg2j5kiQRCuQJPpjKNpVgrAdahQlsEpw== X-Received: by 2002:a5d:4410:: with SMTP id z16-v6mr21595693wrq.272.1533049091996; Tue, 31 Jul 2018 07:58:11 -0700 (PDT) MIME-Version: 1.0 References: <20180730180100.25079-1-guro@fb.com> <20180730180100.25079-2-guro@fb.com> <20180731084509.GE4557@dhcp22.suse.cz> In-Reply-To: <20180731084509.GE4557@dhcp22.suse.cz> From: Shakeel Butt Date: Tue, 31 Jul 2018 07:58:00 -0700 Message-ID: Subject: Re: [PATCH 1/3] mm: introduce mem_cgroup_put() helper To: Michal Hocko Cc: Roman Gushchin , Linux MM , Johannes Weiner , David Rientjes , Tetsuo Handa , Tejun Heo , kernel-team@fb.com, LKML , Andrew Morton , Stephen Rothwell Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jul 31, 2018 at 1:45 AM Michal Hocko wrote: > > 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. > The helper function introduced in this change is also used in the remote charging patches, so, I asked Roman to separate this change out and thus can be merged independently. Shakeel > > 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