[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAMZfGtV4mxn0pqna0BsNAP4eLA7UD-gOJ2XCPU2O0C7VcUJa0g@mail.gmail.com>
Date: Fri, 21 Jan 2022 13:28:05 +0800
From: Muchun Song <songmuchun@...edance.com>
To: Michal Koutný <mkoutny@...e.com>
Cc: Matthew Wilcox <willy@...radead.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Johannes Weiner <hannes@...xchg.org>,
Michal Hocko <mhocko@...nel.org>,
Vladimir Davydov <vdavydov.dev@...il.com>,
Shakeel Butt <shakeelb@...gle.com>,
Roman Gushchin <guro@...com>, Yang Shi <shy828301@...il.com>,
Alex Shi <alexs@...nel.org>,
Wei Yang <richard.weiyang@...il.com>,
Dave Chinner <david@...morbit.com>,
trond.myklebust@...merspace.com, anna.schumaker@...app.com,
jaegeuk@...nel.org, chao@...nel.org,
Kari Argillander <kari.argillander@...il.com>,
linux-fsdevel <linux-fsdevel@...r.kernel.org>,
LKML <linux-kernel@...r.kernel.org>,
Linux Memory Management List <linux-mm@...ck.org>,
linux-nfs@...r.kernel.org, Qi Zheng <zhengqi.arch@...edance.com>,
Xiongchun duan <duanxiongchun@...edance.com>,
Fam Zheng <fam.zheng@...edance.com>,
Muchun Song <smuchun@...il.com>
Subject: Re: [PATCH v5 10/16] mm: list_lru: allocate list_lru_one only when needed
On Wed, Jan 19, 2022 at 5:33 PM Michal Koutný <mkoutny@...e.com> wrote:
>
> On Tue, Jan 18, 2022 at 08:05:44PM +0800, Muchun Song <songmuchun@...edance.com> wrote:
> > I have thought about this. It's a little different to rely on objcg
> > reparenting since the user can get memcg from objcg and
> > then does not realize the memcg has reparented.
>
> When you pointed that out, I'm now also wondering how
> memcg_list_lru_alloc() would be synchronized against
> reparenting/renumbering of kmemcg_ids. What I suspect is that newly
> allocated mlru may be stored into the xarray with a stale kmemcg_id.
The synchronization is based on the lock of list_lru->lock.
memcg_list_lru_free() will help us do housekeeping.
>
> > Maybe holding css_set_lock can do that. I do not think this
> > is a good choice.
>
> I agree, it doesn't sound well.
>
> > Do you have any thoughts about this?
>
> Thoughts / questions of what I don't undestand well:
> - Why do you allocate mlrus for all ancestors in memcg_list_lru_alloc()?
It's because we need to be reparenting.
> - It'd be sufficient to allocate just for the current memcg.
> - Possibly allocate ancestors upon reparenting (to simplify the
> allocation from slab_pre_alloc_hook itself).
I agree it is nice to only allocate for current memcg, but
reparenting cannot handle failure of memory allocation.
>
> - What is the per-kmemcg_id lookup good for?
> - I observe most calls of list_lru_from_memcg_idx() come from callers
> that know memcg (or even objcg).
> - The non-specific use case seems list_lru_walk_node() working with
> per-node and not per-memcg projection.
> - Consequently that is only used over all nodes anyway
> (list_lru_walk().
> - The idea behind this question is -- attach the list_lrus to
> obj_cgroup (and decommission the kmemcg_id completely).
> (Not necessarily part of this series but independent approach.)
>
I have some questions about this thought.
We would attach more than one list_lrus to obj_cgroup,
right? How to arrange those list_lrus, array or linked-list?
Thanks.
Powered by blists - more mailing lists