Re: [PATCH 2/2] mm/memcg: migrate per-node hugetlb lruvec stat together with hugetlb folio

From: Muchun Song

Date: Tue Sep 22 2026 - 02:31:50 EST




> On Sep 22, 2026, at 12:30, Oscar Salvador (SUSE) <osalvador@xxxxxxxxxx> wrote:
>
> On Mon, Sep 21, 2026 at 09:20:53PM -0700, Joshua Hahn wrote:
>> On Tue, 22 Sep 2026 06:15:07 +0200 "Oscar Salvador (SUSE)" <osalvador@xxxxxxxxxx> wrote:
>
>>> Why do we need the whole thing to be embraced by rcu?
>>
>> Hi Oscar,
>
> Hi Joshua,
>
>>
>> I believe it's because now getting the memcg from the objcg requires
>> an RCU lock to make sure it doesn't get removed while we work on the
>> memcg. I think this is since Qi Zheng's "Eliminate Dying Memory
>> Cgroup" series.
>
> Yes, I understood that obj_cgroup_memcg might need the rcu-dance, but I was
> unsure about the mod_memcg_lruvec_state() calls.

The caller needs to make sure the liveness of lruvec, in which case,
lruvec is from memcg, so rcu lock is needed here.

Thanks,
Muchun

>
>
> --
> Oscar Salvador
> SUSE Labs