From: Qi Zheng <qi.zheng@linux.dev>
To: Harry Yoo <harry@kernel.org>,
akpm@linux-foundation.org, david@kernel.org, kasong@tencent.com,
shakeel.butt@linux.dev, baohua@kernel.org,
axelrasmussen@google.com, yuanchu@google.com, weixugc@google.com,
hannes@cmpxchg.org, muchun.song@linux.dev,
peiyang_he@smail.nju.edu.cn, mhocko@kernel.org,
roman.gushchin@linux.dev, ljs@kernel.org
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
Qi Zheng <zhengqi.arch@bytedance.com>,
stable@vger.kernel.org
Subject: Re: [PATCH v2] mm: mglru: fix stale batch updates after memcg reparenting
Date: Thu, 25 Jun 2026 14:11:22 +0800 [thread overview]
Message-ID: <f18bf1b1-ccf7-4d77-9389-07311d2d1613@linux.dev> (raw)
In-Reply-To: <b5c85cea-5daa-4690-ac41-a6f5aebd1555@kernel.org>
On 6/25/26 12:16 PM, Harry Yoo wrote:
>
[...]
>
>> So lock_batch_lruvec() can be implemented like this:
>>
>> #ifdef CONFIG_MEMCG
>> static struct lruvec *lock_batch_lruvec(struct lruvec *lruvec)
>> {
>> struct pglist_data *pgdat = lruvec_pgdat(lruvec);
>> struct mem_cgroup *memcg = lruvec_memcg(lruvec);
>>
>> rcu_read_lock();
>>
>> /*
>> * The memcg can be NULL when the memory controller is disabled.
>> * Otherwise, the caller keeps the memcg owning @lruvec alive.
>> */
>> if (!memcg || !css_is_dying(&memcg->css))
>> goto lock;
>>
>> do {
>> memcg = parent_mem_cgroup(memcg);
>> } while (memcg && css_is_dying(&memcg->css));
>> lruvec = mem_cgroup_lruvec(memcg, pgdat);
>>
>> lock:
>> spin_lock_irq(&lruvec->lru_lock);
>>
>> return lruvec;
>> }
>> #else
>> static struct lruvec *lock_batch_lruvec(struct lruvec *lruvec)
>> {
>> lruvec_lock_irq(lruvec);
>>
>> return lruvec;
>> }
>> #endif
>>
>> Does this make sense?
>
> Yes, looks good to me!
OK, this sync method makes more sense as it doesn't require adding a
new lrugen->reparente. I'll go with this method and update v3.
Hi Barry and Baolin, what do you think? Since the sync method has been
changed, I will temporarily drop your previous Reviewed-by tags in v3. ;)
Thanks,
Qi
>
next prev parent reply other threads:[~2026-06-25 6:11 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-23 2:42 [PATCH v2] mm: mglru: fix stale batch updates after memcg reparenting Qi Zheng
2026-06-23 2:56 ` Qi Zheng
2026-06-23 4:03 ` Baolin Wang
2026-06-23 6:17 ` Harry Yoo
2026-06-23 7:16 ` Qi Zheng
2026-06-23 8:18 ` Harry Yoo
2026-06-23 9:14 ` Qi Zheng
2026-06-24 4:29 ` Harry Yoo
2026-06-24 7:11 ` Qi Zheng
2026-06-25 4:16 ` Harry Yoo
2026-06-25 6:11 ` Qi Zheng [this message]
2026-06-25 6:32 ` Harry Yoo
2026-06-25 7:37 ` Qi Zheng
2026-06-25 8:09 ` Peiyang He
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=f18bf1b1-ccf7-4d77-9389-07311d2d1613@linux.dev \
--to=qi.zheng@linux.dev \
--cc=akpm@linux-foundation.org \
--cc=axelrasmussen@google.com \
--cc=baohua@kernel.org \
--cc=david@kernel.org \
--cc=hannes@cmpxchg.org \
--cc=harry@kernel.org \
--cc=kasong@tencent.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=ljs@kernel.org \
--cc=mhocko@kernel.org \
--cc=muchun.song@linux.dev \
--cc=peiyang_he@smail.nju.edu.cn \
--cc=roman.gushchin@linux.dev \
--cc=shakeel.butt@linux.dev \
--cc=stable@vger.kernel.org \
--cc=weixugc@google.com \
--cc=yuanchu@google.com \
--cc=zhengqi.arch@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.