On Tue, Mar 2, 2021 at 3:09 AM Johannes Weiner <hannes@xxxxxxxxxxx> 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 <songmuchun@xxxxxxxxxxxxx> 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.