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 0CBE8C433B4 for ; Mon, 19 Apr 2021 17:19:21 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 53B7D611F2 for ; Mon, 19 Apr 2021 17:19:20 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 53B7D611F2 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 C7AC26B006C; Mon, 19 Apr 2021 13:19:19 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C2B6A6B006E; Mon, 19 Apr 2021 13:19:19 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A7E5D6B0070; Mon, 19 Apr 2021 13:19:19 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0009.hostedemail.com [216.40.44.9]) by kanga.kvack.org (Postfix) with ESMTP id 8EA7C6B006C for ; Mon, 19 Apr 2021 13:19:19 -0400 (EDT) Received: from smtpin34.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 3B123181AEF39 for ; Mon, 19 Apr 2021 17:19:19 +0000 (UTC) X-FDA: 78049777638.34.1B1439B Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by imf07.hostedemail.com (Postfix) with ESMTP id 9564BA00039C for ; Mon, 19 Apr 2021 17:19:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1618852758; 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=x9OldeANN4a6pkdIYcVnUP/Jno87aqlwEagtGa388Cg=; b=GswOuTlVxoPGonUJOvjeKYbIt/ImF9xUZKzJD0aqD0fio560bH4m7dE8t95K4Ny4OET/mi U4oraAvcV6X3UumOzIShh/dTJqlIPthwPPmY+7BOEohFu3eZS0R/ocnEOr1GGQT0wOSu01 hkb4s/nASgCNBvZUaJaPrE9ZUIDWvEk= Received: from mail-qt1-f197.google.com (mail-qt1-f197.google.com [209.85.160.197]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-131-FMoGF2VWP1CCexVeCuTKKg-1; Mon, 19 Apr 2021 13:19:16 -0400 X-MC-Unique: FMoGF2VWP1CCexVeCuTKKg-1 Received: by mail-qt1-f197.google.com with SMTP id x13-20020ac84d4d0000b02901a95d7c4bb5so9379771qtv.14 for ; Mon, 19 Apr 2021 10:19:16 -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=x9OldeANN4a6pkdIYcVnUP/Jno87aqlwEagtGa388Cg=; b=C+mCdsZSVIJpfhkY2a3GoUJebxL43H+Iy7yPwkF2QjjBcVMQQdgAKGaXqSw8hBulfJ 4Qz6+AOeyDrV360vFUhD5Sh6y9k+nCSY3YazPlCUT3XEhsN0vZ9Okx11bIHEf/lsL2Zr L3NqHVzuBiXvMIbU5biG/2/91HB3wcXTlFPe5Giz8vkfJoATdeWefUp5lDv1mE6nb1MW SGO1zojnx3YpLsipnoq/Vzs/3lAIGmCZ+VpZxWkhzpz2keVYUpW+jTX8rheziICCfBdR cVlBJTz4ILEsepFeOq04LZg3FqLg9H4uvsk1b5WdMUoiryd2g01bg5/ErmID4MKRaBgd 2eMw== X-Gm-Message-State: AOAM533/yDifM9X3U3ei8GpXWv11ckA3TD82/ob1RZD79gavMzyxXej4 yx6X06rZGfLnTrXhSph+hykcAp3o7ZRUtAI44g5pSoJmP9Qb23QkSkvnhdlV7ibOGtsG6jGq9E4 Pg4rdhN1ytB0= X-Received: by 2002:a05:620a:1202:: with SMTP id u2mr11657524qkj.248.1618852755981; Mon, 19 Apr 2021 10:19:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz9b8EgTP3l5q4bSUy95ytyAd5w0lweu9u9pfDmphadF49T09PeZL5Kx54CzS5oQH28K2jBDw== X-Received: by 2002:a05:620a:1202:: with SMTP id u2mr11657492qkj.248.1618852755746; Mon, 19 Apr 2021 10:19:15 -0700 (PDT) Received: from llong.remote.csb ([2601:191:8500:76c0::cdbc]) by smtp.gmail.com with ESMTPSA id q67sm10199456qkb.89.2021.04.19.10.19.14 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 19 Apr 2021 10:19:15 -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: Johannes Weiner , Waiman Long 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:19:13 -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-Queue-Id: 9564BA00039C X-Stat-Signature: rs8ku73zdbr8gbityuj97i8i6erjz6ke X-Rspamd-Server: rspam02 Received-SPF: none (redhat.com>: No applicable sender policy available) receiver=imf07; 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: 1618852758-501209 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: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 wit= hout >>>>> exposing unnecessary details to other mm components. >>>>> >>>>> Signed-off-by: Waiman Long >>>>> --- >>>>> =C2=A0 mm/memcontrol.c | 13 +++++++++++++ >>>>> =C2=A0 mm/slab.h=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 | 16 ++------= -------- >>>>> =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 css_put(&memcg->css); >>>>> =C2=A0 } >>>>> =C2=A0 +void mod_objcg_state(struct obj_cgroup *objcg, struct >>>>> 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 bloc= k 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. Cheers, Longman