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 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 06063C433DB for ; Mon, 1 Mar 2021 19:10:03 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 71C93601FD for ; Mon, 1 Mar 2021 19:10:02 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 71C93601FD Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=cmpxchg.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 0203C8D0098; Mon, 1 Mar 2021 14:10:02 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id F39658D0063; Mon, 1 Mar 2021 14:10:01 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D8BE48D0098; Mon, 1 Mar 2021 14:10:01 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0200.hostedemail.com [216.40.44.200]) by kanga.kvack.org (Postfix) with ESMTP id BF3728D0063 for ; Mon, 1 Mar 2021 14:10:01 -0500 (EST) Received: from smtpin28.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 7BBC6180ACF75 for ; Mon, 1 Mar 2021 19:10:01 +0000 (UTC) X-FDA: 77872245402.28.A409974 Received: from mail-qk1-f175.google.com (mail-qk1-f175.google.com [209.85.222.175]) by imf30.hostedemail.com (Postfix) with ESMTP id 8942CE005F18 for ; Mon, 1 Mar 2021 19:09:58 +0000 (UTC) Received: by mail-qk1-f175.google.com with SMTP id s7so7598738qkg.4 for ; Mon, 01 Mar 2021 11:09:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmpxchg-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=i+xARtY+5W8Bn1AE04i/Ad5rFPbMh8nDWeTLAZo2lK0=; b=Dmi55bD0YEnhSqHee72cnYtTysJPc/UwD5dR9ydldk6GNoQl1/DniyGpHgFg80docR e1KdvcdDDqDdYhzqdjbwQC3WwGcI+gVUYGwEy/2ZHD9FDnWf38mhuSNKbYuja0dkYMwc Dt1ZWtdL/AKMrYyS1KxGZHqiczC3VM3kJ6R+dzCrcHrTE05NQ5F/8yLtHGymvg1aq6BM EXf4Kdm1R/J3x2USifUap32jpSxasFV9xs+YN9M/8OjxeDZd0alUdKogErFvkkhpAax4 4O0hiOHJwEitkpq+e0RPMg7fyDENlKa7NIV1yli4o3coe+gnJvv16u0eFWOoTS7x0HeU rH1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=i+xARtY+5W8Bn1AE04i/Ad5rFPbMh8nDWeTLAZo2lK0=; b=dM+9iAN9nbETlwN4/jI85KypVYEK+ztY1sPVU7DOeJHHfth/EBm+uT5oS8RWr1YOIH KCouoydR15ifx06zWj4uDvDya04S9sR4o+EVW5fTFQgiJUxdu/fkrARd59PZ1EmRf6bP BIagyxGQN4WUYsdmTMnPaHM+LTiOLS+c3gxpLGOSox2WETkHo9T0ud3a9KoEk2xV33NF 9+uK8FJWbIphanCrjVGleU5AooLMxLJk4WbybZ5/4BArfT8jU+nyGbp0wksF3B+CVibc xFt+x1fcwerx4Hvr2CIHvzEks7kDSORTYgOLif0msAz/W7A9Zve3eC3LK3acK5uhBRbu FCXQ== X-Gm-Message-State: AOAM531g5OaHXCw5fv3tCXKxGcxOlIdcAJ9rcptbpYcD0aV/yVflaavL 5KeLaXS7NKSTJvKiH72RZFJZiA== X-Google-Smtp-Source: ABdhPJzw9sBKATTH9+l4/FyjFyJ4xvsDXuoyNe+xu6pg1Fsl6HJWxo2SNSKnwbilZI0nWJ3JIsIPhA== X-Received: by 2002:a37:4a49:: with SMTP id x70mr15969541qka.118.1614625797396; Mon, 01 Mar 2021 11:09:57 -0800 (PST) Received: from localhost ([2620:10d:c091:480::1:c0b0]) by smtp.gmail.com with ESMTPSA id 18sm3329057qkr.90.2021.03.01.11.09.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Mar 2021 11:09:56 -0800 (PST) Date: Mon, 1 Mar 2021 14:09:55 -0500 From: Johannes Weiner To: Shakeel Butt Cc: Muchun Song , Alexander Viro , Jan Kara , Amir Goldstein , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Song Liu , Yonghong Song , john.fastabend@gmail.com, 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 , alexander.h.duyck@linux.intel.com, Chris Down , Wei Yang , Vlastimil Babka , Mathieu Desnoyers , Peter Oskolkov , Jann Horn , Joonsoo Kim , daniel.vetter@ffwll.ch, 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 , duanxiongchun@bytedance.com Subject: Re: [PATCH 2/5] mm: memcontrol: make page_memcg{_rcu} only applicable for non-kmem page Message-ID: References: <20210301062227.59292-1-songmuchun@bytedance.com> <20210301062227.59292-3-songmuchun@bytedance.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 8942CE005F18 X-Stat-Signature: ugbg3jbpz7aardzzffwgkgfrrx198cwg Received-SPF: none (cmpxchg.org>: No applicable sender policy available) receiver=imf30; identity=mailfrom; envelope-from=""; helo=mail-qk1-f175.google.com; client-ip=209.85.222.175 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1614625798-650042 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: 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 ;-) 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.