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=-3.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED 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 3F037C433E0 for ; Tue, 2 Mar 2021 03:50:03 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id DDB1664DE4 for ; Tue, 2 Mar 2021 03:50:02 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DDB1664DE4 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=bytedance.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 555338D00D3; Mon, 1 Mar 2021 22:50:02 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 4DEE28D0063; Mon, 1 Mar 2021 22:50:02 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3A6248D00D3; Mon, 1 Mar 2021 22:50:02 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0159.hostedemail.com [216.40.44.159]) by kanga.kvack.org (Postfix) with ESMTP id 1E63C8D0063 for ; Mon, 1 Mar 2021 22:50:02 -0500 (EST) Received: from smtpin14.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id D149F62CC for ; Tue, 2 Mar 2021 03:50:01 +0000 (UTC) X-FDA: 77873555802.14.FFCDF10 Received: from mail-pf1-f170.google.com (mail-pf1-f170.google.com [209.85.210.170]) by imf19.hostedemail.com (Postfix) with ESMTP id A629490009ED for ; Tue, 2 Mar 2021 03:49:58 +0000 (UTC) Received: by mail-pf1-f170.google.com with SMTP id r5so12933367pfh.13 for ; Mon, 01 Mar 2021 19:49:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=zR9rZ5Vo7n4Jx4LSiCHtKNBAWL0tmz/mJnFtTbDqbIU=; b=v9fAqyuNhDoUw3dtU1vnpYtIU5IhN9QKuc3uYH/Oncb9JTBA0DAi9YtlWkm2stJ90r +PRYhf+SGzC8j9uqnJHPm3vCzMPuzAlnRV+vZMvYST7E5TMq44Rfk3kwAWcFcB46Sq41 vFesKUHLPs83TWyyQCS5dXK5ciQhNVQKs4VGeOCSJchW2M9Dd07uGTBp4LJtvxYatGgm sha9dr2oAKShevSBQhU6iX58QJjZVzwmCF0nNJCAcZeNG/9JX/jUobwm9Bc9XIzTh7wD oMMjslfibt+eQ+1H+3/V5FkViK5z1Qxnvh3OuG/KKQ6i1oEnosdWfybQ1+34pqH7hfV2 +ufg== 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=zR9rZ5Vo7n4Jx4LSiCHtKNBAWL0tmz/mJnFtTbDqbIU=; b=AzFMCspMDlbGMNr6VJo3gxx7iWAN5tl4shgcIQxzVrdlSTNAy/X1ppxi3GI0xLbrd9 Lo1TlLfpf+IwO4Vs7or/98JzNjAqQ2e9pZFV+V2uNQ4msiKbSQJMB4xzxuN+O70a/YQh MZm5PxSrS1mpFfp6gIENiN0RSgeZam/EuUZ8FeEDBrndTRfzqEMGA5BVwE+KlRIT3PEu Bm9x3t7NnKG7NEZvrshYVXjL4pEJb43ZW3b8b6TlfomwhKrhTPjnA5uZ15LYC6B1yJMg EGDcb5w/ESCJkHAgzh9ZNiJrcfC3seaOnTGDEDMN7Z2S9aDz7Zq5BHCyiaqYb9rGiyT3 hSmg== X-Gm-Message-State: AOAM532aQKdMuKZfPPsg21eaUfuRhP9HFePpo40UcV1Xf+Ll3E7UGAUH b8vRVYFrnVCx+PYxtWSj67jZpQs7jK1TohPg4vrQWA== X-Google-Smtp-Source: ABdhPJwJdS00GRwevcvlOVHxIsflvCdg261M0N1nQh/iDPP8PMYFMy/+PL0boqZQvRsNKQzFMclQJCc/iXcXQrgJaAk= X-Received: by 2002:a65:6645:: with SMTP id z5mr16134496pgv.273.1614656997583; Mon, 01 Mar 2021 19:49:57 -0800 (PST) MIME-Version: 1.0 References: <20210301062227.59292-1-songmuchun@bytedance.com> <20210301062227.59292-3-songmuchun@bytedance.com> In-Reply-To: From: Muchun Song Date: Tue, 2 Mar 2021 11:49:21 +0800 Message-ID: Subject: Re: [External] Re: [PATCH 2/5] mm: memcontrol: make page_memcg{_rcu} only applicable for non-kmem page To: Johannes Weiner Cc: Shakeel Butt , Alexander Viro , Jan Kara , Amir Goldstein , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , kpsingh@kernel.org, Ingo Molnar , "Peter Zijlstra (Intel)" , Juri Lelli , Vincent Guittot , dietmar.eggemann@arm.com, Steven Rostedt , Benjamin Segall , Mel Gorman , bristot@redhat.com, Michal Hocko , Vladimir Davydov , Andrew Morton , Roman Gushchin , Alex Shi , Chris Down , Wei Yang , Vlastimil Babka , Mathieu Desnoyers , Peter Oskolkov , Jann Horn , Joonsoo Kim , Daniel Vetter , Waiman Long , Michel Lespinasse , Christian Brauner , "Eric W. Biederman" , Kees Cook , krisman@collabora.com, esyr@redhat.com, Suren Baghdasaryan , Marco Elver , linux-fsdevel , LKML , netdev , bpf , Cgroups , Linux MM , Xiongchun duan Content-Type: text/plain; charset="UTF-8" X-Stat-Signature: 5fn413x5c17uiimp4wjc54a1a4fcnqph X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: A629490009ED Received-SPF: none (bytedance.com>: No applicable sender policy available) receiver=imf19; identity=mailfrom; envelope-from=""; helo=mail-pf1-f170.google.com; client-ip=209.85.210.170 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1614656998-199512 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 Tue, Mar 2, 2021 at 3:09 AM Johannes Weiner wrote: > > Muchun, can you please reduce the CC list to mm/memcg folks only for > the next submission? I think probably 80% of the current recipients > don't care ;-) At first, I just used scripts/get_maintainer.pl to get the CC list. I will reduce the CC list in the next version. Thanks. > > On Mon, Mar 01, 2021 at 10:11:45AM -0800, Shakeel Butt wrote: > > On Sun, Feb 28, 2021 at 10:25 PM Muchun Song wrote: > > > > > > We want to reuse the obj_cgroup APIs to reparent the kmem pages when > > > the memcg offlined. If we do this, we should store an object cgroup > > > pointer to page->memcg_data for the kmem pages. > > > > > > Finally, page->memcg_data can have 3 different meanings. > > > > > > 1) For the slab pages, page->memcg_data points to an object cgroups > > > vector. > > > > > > 2) For the kmem pages (exclude the slab pages), page->memcg_data > > > points to an object cgroup. > > > > > > 3) For the user pages (e.g. the LRU pages), page->memcg_data points > > > to a memory cgroup. > > > > > > Currently we always get the memcg associated with a page via page_memcg > > > or page_memcg_rcu. page_memcg_check is special, it has to be used in > > > cases when it's not known if a page has an associated memory cgroup > > > pointer or an object cgroups vector. Because the page->memcg_data of > > > the kmem page is not pointing to a memory cgroup in the later patch, > > > the page_memcg and page_memcg_rcu cannot be applicable for the kmem > > > pages. In this patch, we introduce page_memcg_kmem to get the memcg > > > associated with the kmem pages. And make page_memcg and page_memcg_rcu > > > no longer apply to the kmem pages. > > > > > > In the end, there are 4 helpers to get the memcg associated with a > > > page. The usage is as follows. > > > > > > 1) Get the memory cgroup associated with a non-kmem page (e.g. the LRU > > > pages). > > > > > > - page_memcg() > > > - page_memcg_rcu() > > > > Can you rename these to page_memcg_lru[_rcu] to make them explicitly > > for LRU pages? > > The next patch removes page_memcg_kmem() again to replace it with > page_objcg(). That should (luckily) remove the need for this > distinction and keep page_memcg() simple and obvious. > > It would be better to not introduce page_memcg_kmem() in the first > place in this patch, IMO. OK. I will follow your suggestion. Thanks.