Re: [PATCH v2] mm: do not try to migrate lru_gen if it's not associated with a memcg

From: David Hildenbrand
Date: Mon Jan 16 2023 - 12:35:32 EST


On 16.01.23 00:13, Yu Zhao wrote:
On Sun, Jan 15, 2023 at 6:47 AM msizanoen1 <msizanoen@xxxxxxxxxxx> wrote:

In some cases, memory cgroup migration can be initiated by userspace
right after a process was created and right before `lru_gen_add_mm()` is
called (e.g. by some program watching a cgroup and moving away any
processes it detects[1]), which results in the following sequence of
WARNs followed by an Oops as the kernel attempts to perform a
`lru_gen_add_mm()` twice on the same `mm`:

...

Fix this by simply leaving the lru_gen alone if it has not been
associated with a memcg yet, as it should eventually be assigned to the
right cgroup anyway.

[1]: https://gitlab.freedesktop.org/benzea/uresourced/-/blob/master/cgroupify/cgroupify.c

v2:
Added stable cc tags

Signed-off-by: N/A (patch should not be copyrightable)
Cc: stable@xxxxxxxxxxxxxxx

Thanks for the fix. Cc'ing stable is the right thing to do. The
commit message and the comment styles could be easily adjusted to
align with the guidelines.

I don't think the N/A is acceptible though. I fully respect it if you
wish to remain anonymous -- I can send a similar fix crediting you
as the "anonymous user <msizanoen@xxxxxxxxxxx>" who reported this bug.

Not acceptable:

Documentation/process/submitting-patches.rs

"using your real name (sorry, no pseudonyms or anonymous contributions.)"


--
Thanks,

David / dhildenb