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=-13.2 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_IN_DEF_DKIM_WL 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 5CA6BC43142 for ; Tue, 2 Mar 2021 08:50:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2801A61494 for ; Tue, 2 Mar 2021 08:50:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1381911AbhCBIrZ (ORCPT ); Tue, 2 Mar 2021 03:47:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38422 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235231AbhCBDhg (ORCPT ); Mon, 1 Mar 2021 22:37:36 -0500 Received: from mail-lj1-x236.google.com (mail-lj1-x236.google.com [IPv6:2a00:1450:4864:20::236]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CB8B1C0617A7 for ; Mon, 1 Mar 2021 19:36:06 -0800 (PST) Received: by mail-lj1-x236.google.com with SMTP id u18so8531346ljd.3 for ; Mon, 01 Mar 2021 19:36:06 -0800 (PST) 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=Bz8uBe6K2P4L9vYFmzU92KcgY6OwUuT5aKcfnajTyTg=; b=nkB9r6nlkun78l+tTKiB4tMDKf8CVmwjMOSIPEbEjNd/Nsk2XEBNYxNAojcBzAYLbk AZ3qK4rVhYuFxAla4ozwFJtYD6Z/O9p4yeXZSEk0nk7YbhHS5lPs/vuhEz3978eNX5AX LtqI+33Hy9KMfhUx1wQVkD0jWXw0lzhf4B0Kvyv2KVTZpep4bje6Zrz3lpx8w7lS2Ba/ Ug6WUvlub1YxrFZctmw4sFRV3100p1Tskm/QI44+PhyTHAD2zkAS8opGBhLwCozw2gYJ CpEePgQiSg0GZQN703Eua+bpSAfSr8N72ruBvYM+xHPikZHkpvGIEMslReFyG3+gg62d EW/A== 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=Bz8uBe6K2P4L9vYFmzU92KcgY6OwUuT5aKcfnajTyTg=; b=If/KU8X8AAHmhU3qp3x+jftLWjlgtFI9HFwBmEiEL0C4mp+i6smSnLKT3s2WyAeI2d M9EEv4+u4lFCD7RdUD44uhxzXT60SJGg5T1eC1mWJT8QpVgle/fgwawsCcTqGdlY9maO zlSPOWQtp3zwauOF72+glvdG3wLwOVZno+6/Jz48HUb62pDAfa05N8+GPJQPNTFUaU0X zAlo4oCS/KgSek3kw7WCkUVwSz9xRv4eQvjlEXEpEwV0utVm+nnaaHq12YcKKYekoyAx Tlou6i3M2wIl+T3F4tJvjNY9SOijlvEmpSCoE25OxUTR94S8NLyaWs44suykYWhIVglP kjYQ== X-Gm-Message-State: AOAM531tEllx1AwCZkC+D3HW2ZvkzQuI0kJk6mLjDegtHH2IAVLigiGe ROdn4dmTrGNhrHjAbelJKCop0L/qjf/osiTeNbBUNQ== X-Google-Smtp-Source: ABdhPJzJtFE+1oSFYwIpEGPFNzE9zYTgKDQwzxAeND6Yrtul3/tDAbpsz02NMRsNm2sVGPuN4J8NCXA5gSql+ypr8no= X-Received: by 2002:a2e:9cc4:: with SMTP id g4mr2003504ljj.34.1614656164850; Mon, 01 Mar 2021 19:36:04 -0800 (PST) MIME-Version: 1.0 References: <20210301062227.59292-1-songmuchun@bytedance.com> <20210301062227.59292-3-songmuchun@bytedance.com> In-Reply-To: From: Shakeel Butt Date: Mon, 1 Mar 2021 19:35:53 -0800 Message-ID: Subject: Re: [External] Re: [PATCH 2/5] mm: memcontrol: make page_memcg{_rcu} only applicable for non-kmem page To: Muchun Song Cc: 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, Johannes Weiner , 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" Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Mon, Mar 1, 2021 at 7:03 PM Muchun Song wrote: > > On Tue, Mar 2, 2021 at 2:11 AM 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? > > Yes. Will do. Thanks. > Please follow Johannes' suggestion regarding page_memcg_kmem() and then no need to rename these.