From: Kairui Song <ryncsn@gmail.com>
To: Muchun Song <muchun.song@linux.dev>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Matthew Wilcox <willy@infradead.org>,
Johannes Weiner <hannes@cmpxchg.org>,
Roman Gushchin <roman.gushchin@linux.dev>,
Waiman Long <longman@redhat.com>,
Shakeel Butt <shakeelb@google.com>, Nhat Pham <nphamcs@gmail.com>,
Michal Hocko <mhocko@suse.com>,
Chengming Zhou <zhouchengming@bytedance.com>,
Qi Zheng <zhengqi.arch@bytedance.com>,
Chris Li <chrisl@kernel.org>,
Yosry Ahmed <yosryahmed@google.com>,
"Huang, Ying" <ying.huang@intel.com>,
linux-mm@kvack.org
Subject: Re: [PATCH 4/7] mm/list_lru: code clean up for reparenting
Date: Tue, 16 Jul 2024 16:15:52 +0800 [thread overview]
Message-ID: <CAMgjq7CPss01BqutQj_y-R4DO52pxHT1TUuHMqcSnUFgemwExA@mail.gmail.com> (raw)
In-Reply-To: <66591895-356b-48bf-b4ac-5cec5c29ae8d@linux.dev>
On Mon, Jul 15, 2024 at 5:12 PM Muchun Song <muchun.song@linux.dev> wrote:
> On 2024/6/25 01:53, Kairui Song wrote:
> > From: Kairui Song <kasong@tencent.com>
> >
> > No feature change, just change of code structure and fix comment.
> >
> > The list lrus are not empty until memcg_reparent_list_lru_node() calls
> > are all done, so the comments in memcg_offline_kmem were slightly
> > inaccurate.
> >
> > Signed-off-by: Kairui Song <kasong@tencent.com>
> > ---
> > mm/list_lru.c | 39 +++++++++++++++++----------------------
> > mm/memcontrol.c | 7 -------
> > 2 files changed, 17 insertions(+), 29 deletions(-)
> >
> > diff --git a/mm/list_lru.c b/mm/list_lru.c
> > index 9d9ec8661354..4c619857e916 100644
> > --- a/mm/list_lru.c
> > +++ b/mm/list_lru.c
> > @@ -405,35 +405,16 @@ static void memcg_reparent_list_lru_node(struct list_lru *lru, int nid,
> > spin_unlock_irq(&nlru->lock);
> > }
> >
> > -static void memcg_reparent_list_lru(struct list_lru *lru,
> > - int src_idx, struct mem_cgroup *dst_memcg)
> > -{
> > - int i;
> > -
> > - for_each_node(i)
> > - memcg_reparent_list_lru_node(lru, i, src_idx, dst_memcg);
> > -
> > - memcg_list_lru_free(lru, src_idx);
> > -}
> > -
> > void memcg_reparent_list_lrus(struct mem_cgroup *memcg, struct mem_cgroup *parent)
> > {
> > struct cgroup_subsys_state *css;
> > struct list_lru *lru;
> > - int src_idx = memcg->kmemcg_id;
> > + int src_idx = memcg->kmemcg_id, i;
> >
> > /*
> > * Change kmemcg_id of this cgroup and all its descendants to the
> > * parent's id, and then move all entries from this cgroup's list_lrus
> > * to ones of the parent.
> > - *
> > - * After we have finished, all list_lrus corresponding to this cgroup
> > - * are guaranteed to remain empty. So we can safely free this cgroup's
> > - * list lrus in memcg_list_lru_free().
> > - *
> > - * Changing ->kmemcg_id to the parent can prevent memcg_list_lru_alloc()
> > - * from allocating list lrus for this cgroup after memcg_list_lru_free()
> > - * call.
> > */
> > rcu_read_lock();
> > css_for_each_descendant_pre(css, &memcg->css) {
> > @@ -444,9 +425,23 @@ void memcg_reparent_list_lrus(struct mem_cgroup *memcg, struct mem_cgroup *paren
> > }
> > rcu_read_unlock();
> >
> > + /*
> > + * With kmemcg_id set to parent, holding the lru lock below can
>
> The word of "below" confuses me a bit. "lru lock below" refers to 1)
> "list_lrus_mutex"
> or the 2) lock in "struct list_lru_node"?
>
> I think it is 2), right?
Yes, that's 2).
> The chnges LGTM.
>
> Reviewed-by: Muchun Song <muchun.song@linux.dev>
Thanks, I can make the comments more concrete in the next version.
next prev parent reply other threads:[~2024-07-16 8:16 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-24 17:53 [PATCH 0/7] Split list_lru lock into per-cgroup scope Kairui Song
2024-06-24 17:53 ` [PATCH 1/7] mm/swap, workingset: make anon workingset nodes memcg aware Kairui Song
2024-07-17 3:25 ` Muchun Song
2024-07-18 11:33 ` Kairui Song
2024-07-19 1:34 ` Shakeel Butt
2024-06-24 17:53 ` [PATCH 2/7] mm/list_lru: don't pass unnecessary key parameters Kairui Song
2024-06-24 17:53 ` [PATCH 3/7] mm/list_lru: don't export list_lru_add Kairui Song
2024-07-17 3:12 ` Muchun Song
2024-06-24 17:53 ` [PATCH 4/7] mm/list_lru: code clean up for reparenting Kairui Song
2024-07-15 9:10 ` Muchun Song
2024-07-16 8:15 ` Kairui Song [this message]
2024-06-24 17:53 ` [PATCH 5/7] mm/list_lru: simplify reparenting and initial allocation Kairui Song
2024-07-17 3:04 ` Muchun Song
2024-07-18 11:49 ` Kairui Song
2024-07-19 2:45 ` Muchun Song
2024-06-24 17:53 ` [PATCH 6/7] mm/list_lru: split the lock to per-cgroup scope Kairui Song
2024-06-24 17:53 ` [PATCH 7/7] mm/list_lru: Simplify the list_lru walk callback function Kairui Song
2024-06-27 19:58 ` kernel test robot
2024-06-24 21:26 ` [PATCH 0/7] Split list_lru lock into per-cgroup scope Andrew Morton
2024-06-25 7:47 ` Kairui Song
2024-06-25 17:00 ` Shakeel Butt
2024-08-27 18:35 ` Shakeel Butt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAMgjq7CPss01BqutQj_y-R4DO52pxHT1TUuHMqcSnUFgemwExA@mail.gmail.com \
--to=ryncsn@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=chrisl@kernel.org \
--cc=hannes@cmpxchg.org \
--cc=linux-mm@kvack.org \
--cc=longman@redhat.com \
--cc=mhocko@suse.com \
--cc=muchun.song@linux.dev \
--cc=nphamcs@gmail.com \
--cc=roman.gushchin@linux.dev \
--cc=shakeelb@google.com \
--cc=willy@infradead.org \
--cc=ying.huang@intel.com \
--cc=yosryahmed@google.com \
--cc=zhengqi.arch@bytedance.com \
--cc=zhouchengming@bytedance.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).