From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.1 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BF58DC433B4 for ; Mon, 19 Apr 2021 17:26:36 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 4F0CC61285 for ; Mon, 19 Apr 2021 17:26:36 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4F0CC61285 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id A3C956B0036; Mon, 19 Apr 2021 13:26:35 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A00056B006E; Mon, 19 Apr 2021 13:26:35 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 87A9E6B0070; Mon, 19 Apr 2021 13:26:35 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0148.hostedemail.com [216.40.44.148]) by kanga.kvack.org (Postfix) with ESMTP id 6F8CA6B0036 for ; Mon, 19 Apr 2021 13:26:35 -0400 (EDT) Received: from smtpin38.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 254908249980 for ; Mon, 19 Apr 2021 17:26:35 +0000 (UTC) X-FDA: 78049795950.38.BD23197 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by imf29.hostedemail.com (Postfix) with ESMTP id 5B0E0E8 for ; Mon, 19 Apr 2021 17:26:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1618853193; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=bP0dgJylGUHZI2K8PCqLGYvIKzzqMKEmXpSiyAKkpRw=; b=CVjqQJ+vaxc17PoM3xoItSAX/nnU4ATvdY7CRDTK+jQXOrLep/gUNDTPpXEZjIg4LH4et/ yTIBZOAKYLtgzyJXGxZjq0cQ5eLwJh2ewXYIXvpn6SiEBRRyxPzcJJACZ/SCTfbbYQ+yeT uSSTKF5Nd4NO1pQ+nS1smDJT0LlntVQ= Received: from mail-qk1-f197.google.com (mail-qk1-f197.google.com [209.85.222.197]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-91-pfkU5WKvPeycnNG889wW5w-1; Mon, 19 Apr 2021 13:26:32 -0400 X-MC-Unique: pfkU5WKvPeycnNG889wW5w-1 Received: by mail-qk1-f197.google.com with SMTP id p133-20020a37428b0000b02902de31dd8da3so5221173qka.1 for ; Mon, 19 Apr 2021 10:26:32 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:subject:to:cc:references:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=bP0dgJylGUHZI2K8PCqLGYvIKzzqMKEmXpSiyAKkpRw=; b=ArSLXE50Jh2iYWmrI4pk4DRR1ZDMcT87OCH1iWu1FfRO4ymwvpX/EcZ2Xz5nYl9bb8 O38hJMRZfqdWy3yNcisu3yx1ubNWkg41uagxTc4SAlIYTHVoBOinYOVbhk+BVuRaEtef zhyZ/zANeGO7BsGJ8fVTPf59VMUWjCnlB7/kYur+QFtE5/pflU0g9wisoDD7Ez+E0+Cs 9i73zjqFsT8ULDR21kAyajvObXkzP82FZ5s6dSkxzDsAXDIglEKNcUQe+lRzLhyP3ah4 b6JwK71w5h0LmseMMi3lvcCRQzOgERHT5NxtiAakKOOpSpscFz/+LhDJzZXkndSqVY3v hTdg== X-Gm-Message-State: AOAM532Fb+m44XVNvg2k01D3EX6PuQCopiNYkw4TBGaeCtPQlt+9PlEW UCT/jXku+l75hTwzf1YFdfQGs3bQUw46iAkod1yjM/E6nX7YinwE01dRkcrRemh6IMus9aMz53x 0LExcTKd/7hk= X-Received: by 2002:ac8:b45:: with SMTP id m5mr12675859qti.56.1618853191880; Mon, 19 Apr 2021 10:26:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwIZTibzrz4kicze63i+d0ejCOInPjvw1tyWYei7C0LpWKnxlmJLHYVjQAc/5TcNHS8aZuk7Q== X-Received: by 2002:ac8:b45:: with SMTP id m5mr12675845qti.56.1618853191705; Mon, 19 Apr 2021 10:26:31 -0700 (PDT) Received: from llong.remote.csb ([2601:191:8500:76c0::cdbc]) by smtp.gmail.com with ESMTPSA id a187sm10080819qkd.69.2021.04.19.10.26.30 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 19 Apr 2021 10:26:31 -0700 (PDT) From: Waiman Long X-Google-Original-From: Waiman Long Subject: Re: [PATCH v4 1/5] mm/memcg: Move mod_objcg_state() to memcontrol.c To: Waiman Long , Johannes Weiner Cc: Michal Hocko , Vladimir Davydov , Andrew Morton , Tejun Heo , Christoph Lameter , Pekka Enberg , David Rientjes , Joonsoo Kim , Vlastimil Babka , Roman Gushchin , linux-kernel@vger.kernel.org, cgroups@vger.kernel.org, linux-mm@kvack.org, Shakeel Butt , Muchun Song , Alex Shi , Chris Down , Yafang Shao , Wei Yang , Masayoshi Mizuma , Xing Zhengjun , Matthew Wilcox References: <20210419000032.5432-1-longman@redhat.com> <20210419000032.5432-2-longman@redhat.com> <140444ea-14e7-b305-910f-f23fafe45488@redhat.com> Message-ID: Date: Mon, 19 Apr 2021 13:26:29 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.9.0 MIME-Version: 1.0 In-Reply-To: Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=llong@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 5B0E0E8 X-Stat-Signature: g4foyfou6twdz4w4hud8jrigeybkgd5g Received-SPF: none (redhat.com>: No applicable sender policy available) receiver=imf29; identity=mailfrom; envelope-from=""; helo=us-smtp-delivery-124.mimecast.com; client-ip=216.205.24.124 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1618853192-688561 Content-Transfer-Encoding: quoted-printable X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On 4/19/21 1:19 PM, Waiman Long wrote: > On 4/19/21 1:13 PM, Johannes Weiner wrote: >> On Mon, Apr 19, 2021 at 12:18:29PM -0400, Waiman Long wrote: >>> On 4/19/21 11:21 AM, Waiman Long wrote: >>>> On 4/19/21 11:14 AM, Johannes Weiner wrote: >>>>> On Sun, Apr 18, 2021 at 08:00:28PM -0400, Waiman Long wrote: >>>>>> The mod_objcg_state() function is moved from mm/slab.h to >>>>>> mm/memcontrol.c >>>>>> so that further optimization can be done to it in later patches=20 >>>>>> without >>>>>> exposing unnecessary details to other mm components. >>>>>> >>>>>> Signed-off-by: Waiman Long >>>>>> --- >>>>>> =C2=A0=C2=A0 mm/memcontrol.c | 13 +++++++++++++ >>>>>> =C2=A0=C2=A0 mm/slab.h=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 | 16 ++= -------------- >>>>>> =C2=A0=C2=A0 2 files changed, 15 insertions(+), 14 deletions(-) >>>>>> >>>>>> diff --git a/mm/memcontrol.c b/mm/memcontrol.c >>>>>> index e064ac0d850a..dc9032f28f2e 100644 >>>>>> --- a/mm/memcontrol.c >>>>>> +++ b/mm/memcontrol.c >>>>>> @@ -3150,6 +3150,19 @@ void __memcg_kmem_uncharge_page(struct >>>>>> page *page, int order) >>>>>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 css_put(&memcg->css); >>>>>> =C2=A0=C2=A0 } >>>>>> =C2=A0=C2=A0 +void mod_objcg_state(struct obj_cgroup *objcg, struc= t >>>>>> pglist_data *pgdat, >>>>>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0 enum node_stat_item idx, int nr) >>>>>> +{ >>>>>> +=C2=A0=C2=A0=C2=A0 struct mem_cgroup *memcg; >>>>>> +=C2=A0=C2=A0=C2=A0 struct lruvec *lruvec =3D NULL; >>>>>> + >>>>>> +=C2=A0=C2=A0=C2=A0 rcu_read_lock(); >>>>>> +=C2=A0=C2=A0=C2=A0 memcg =3D obj_cgroup_memcg(objcg); >>>>>> +=C2=A0=C2=A0=C2=A0 lruvec =3D mem_cgroup_lruvec(memcg, pgdat); >>>>>> +=C2=A0=C2=A0=C2=A0 mod_memcg_lruvec_state(lruvec, idx, nr); >>>>>> +=C2=A0=C2=A0=C2=A0 rcu_read_unlock(); >>>>>> +} >>>>> It would be more naturally placed next to the others, e.g. below >>>>> __mod_lruvec_kmem_state(). >>>>> >>>>> But no deal breaker if there isn't another revision. >>>>> >>>>> Acked-by: Johannes Weiner >>>>> >>>> Yes, there will be another revision by rebasing patch series on the >>>> linux-next. I will move the function then. >>> OK, it turns out that mod_objcg_state() is only defined if >>> CONFIG_MEMCG_KMEM. That was why I put it in the CONFIG_MEMCG_KMEM=20 >>> block with >>> the other obj_stock functions. I think I will keep it there. >> The CONFIG_MEMCG_KMEM has become sort of useless now. It used to be >> configurable, but now it just means CONFIG_MEMCG && !CONFIG_SLOB. And >> even that doesn't make sense because while slob doesn't support slab >> object tracking, we can still do all the other stuff we do under >> KMEM. I have a patch in the works to remove the symbol and ifdefs. >> >> With that in mind, it's better to group the functions based on what >> they do rather than based on CONFIG_MEMCG_KMEM. It's easier to just >> remove another ifdef later than it is to reorder the functions. >> > OK, I will make the move then. Thanks for the explanation.=20 BTW, have you ever thought of moving the cgroup-v1 specific functions=20 out into a separate memcontrol-v1.c file just like=20 kernel/cgroup/cgroup-v1.c? I thought of that before, but memcontrol.c is a frequently changed file=20 and so a bit hard to do. Cheers, Longman