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=-7.3 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no 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 BDBA7C433ED for ; Thu, 15 Apr 2021 16:59:41 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 638DE6124B for ; Thu, 15 Apr 2021 16:59:41 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 638DE6124B 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 F28116B0036; Thu, 15 Apr 2021 12:59:40 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id ED7C96B006C; Thu, 15 Apr 2021 12:59:40 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D2A976B0070; Thu, 15 Apr 2021 12:59:40 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0049.hostedemail.com [216.40.44.49]) by kanga.kvack.org (Postfix) with ESMTP id B31336B0036 for ; Thu, 15 Apr 2021 12:59:40 -0400 (EDT) Received: from smtpin13.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 6893E82499B9 for ; Thu, 15 Apr 2021 16:59:40 +0000 (UTC) X-FDA: 78035212920.13.AE61AF9 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by imf14.hostedemail.com (Postfix) with ESMTP id 5B8FCC0007E6 for ; Thu, 15 Apr 2021 16:59:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1618505979; 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=elHrGsyviNRX+T8DndgeK2yskuXfifgVcBuAA2Ta4Ok=; b=ewyXg4zk7G8LPtm97g8uMyScjtrJePy7OCx2SFjFsyU0Z85qgGi7wh+cEV9rB9wSh7TcPW c89zEp/NM3T70m2NioU9smDZgnTGxrZxG6DyNYlbgDMFVdJbz0+APdu34658zc6Fu2kea5 /D3XGef37+yY+RPxaTRzDF0PuIHttas= Received: from mail-qv1-f69.google.com (mail-qv1-f69.google.com [209.85.219.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-101-O33-XZdgP9a01g-uaYmeQQ-1; Thu, 15 Apr 2021 12:59:37 -0400 X-MC-Unique: O33-XZdgP9a01g-uaYmeQQ-1 Received: by mail-qv1-f69.google.com with SMTP id z17-20020a0cf0110000b029019a84330150so2203332qvk.13 for ; Thu, 15 Apr 2021 09:59:37 -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=elHrGsyviNRX+T8DndgeK2yskuXfifgVcBuAA2Ta4Ok=; b=jhke0fSgZy3go8I1GsutGGqRrLkDhoGvzqaZrMCzUzjqKxmigK1NBE1zT+KO9jB0ef B8bF3LKWBChbY6nt7UPxnjhY5KEylnb4sYTuDODWsb9bU9az4HD98+O0xI0AehWeo7Ib jDTvgk7+DeJmQ6E6h8iVDm8e392P3kvi+3aC0IKOKnbwaNHBQ9d/Xo3BH4fMpI2qtmW6 ce7NIrjW5Jp4/6QpZA73CUCK3heMSwMeiJe8o4LfOrZRwVGMkI/yseD/oLPIVEt7Kns+ jYj1Q2feWFoSkKgcIUIWjoB6kHMp9EbX+myqmy9JO7vEYdzCG/jlVR40th5HbJztD9Xj 4vyg== X-Gm-Message-State: AOAM533pTg9R0aM+RjyfZpEijpBwJCJINqptmTjBEwmz2wfSW2tz6czo 4mMi7oX9BRBw1AaaYa18b5YFeyYDpEsSYJpV50DsbaqIt6FOxliHt+C3lng+b7k9co4UYjgCFFu q8C5pJO6rao8= X-Received: by 2002:a05:622a:11cd:: with SMTP id n13mr312362qtk.37.1618505974931; Thu, 15 Apr 2021 09:59:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyvAPNkVJI8wUxitPnbMVkF+NPMJpjx0i3yeexynXZiZOvFXpqTEJad03ray4v6M3SeArr5Zw== X-Received: by 2002:a05:620a:13a6:: with SMTP id m6mr4535437qki.64.1618505963716; Thu, 15 Apr 2021 09:59:23 -0700 (PDT) Received: from llong.remote.csb ([2601:191:8500:76c0::cdbc]) by smtp.gmail.com with ESMTPSA id h65sm2349848qkc.128.2021.04.15.09.59.22 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 15 Apr 2021 09:59:23 -0700 (PDT) From: Waiman Long X-Google-Original-From: Waiman Long Subject: Re: [PATCH v3 1/5] mm/memcg: Pass both memcg and lruvec to mod_memcg_lruvec_state() To: 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 References: <20210414012027.5352-1-longman@redhat.com> <20210414012027.5352-2-longman@redhat.com> Message-ID: <59a85df9-3e77-1d43-8673-2ff50a741130@redhat.com> Date: Thu, 15 Apr 2021 12:59:21 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.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-Transfer-Encoding: 7bit Content-Language: en-US X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 5B8FCC0007E6 X-Stat-Signature: kc8syrgach9infmtkdp19dpqbcfazbb3 Received-SPF: none (redhat.com>: No applicable sender policy available) receiver=imf14; 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: 1618505971-86097 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/15/21 12:40 PM, Johannes Weiner wrote: > On Tue, Apr 13, 2021 at 09:20:23PM -0400, Waiman Long wrote: >> The caller of mod_memcg_lruvec_state() has both memcg and lruvec readily >> available. So both of them are now passed to mod_memcg_lruvec_state() >> and __mod_memcg_lruvec_state(). The __mod_memcg_lruvec_state() is >> updated to allow either of the two parameters to be set to null. This >> makes mod_memcg_lruvec_state() equivalent to mod_memcg_state() if lruvec >> is null. >> >> The new __mod_memcg_lruvec_state() function will be used in the next >> patch as a replacement of mod_memcg_state() in mm/percpu.c for the >> consolidation of the memory uncharge and vmstat update functions in >> the kmem_cache_free() path. > This requires users who want both to pass a pgdat that can be derived > from the lruvec. This is error prone, and we just acked a patch that > removes this very thing from mem_cgroup_page_lruvec(). > > With the suggestion for patch 2, this shouldn't be necessary anymore, > though. And sort of underlines my point around that combined function > creating akwward code above and below it. > The reason of passing in the pgdat is because of the caching of vmstat data. lruvec may be gone if the corresponding memory cgroup is removed, but pgdat should stay put. That is why I put pgdat in the obj_stock for caching. I could also put the node id instead of pgdat. Cheers, Longman