Re: [PATCH 01/21] mm/hugetlb: charge the copy made at fork to the parent
From: David Hildenbrand (Arm)
Date: Wed Dec 02 2026 - 15:30:25 EST
On 12/2/26 21:07, Harry Yoo wrote:
> On Wed, Nov 25, 2026 at 11:32:59PM +0100, David Hildenbrand (Arm) wrote:
>> When copying page tables during fork(), the child is not yet assigned to
>> the right memcg. When copying possibly pinned anon hugetlb folios, we
>> must charge them to the parent's memcg, otherwise we can end up
>> allocating more hugetlb folios than allowed.
>>
>> Let's fix it by charging the copy to the parent's mm, like we do when
>> copying small folios in copy_present_page(), introducing a new helper
>> function alloc_hugetlb_folio_for_fork().
>>
>> This is a hotfix for v7.4.
>>
>> Fixes: c2deb1356d82 ("mm/hugetlb: charge folios to the target mm's memcg")
>> Reported-by: Chris Mason <mason@xxxxxxxxxx>
>> Acked-by: Michal Hocko <mhocko@xxxxxxxx>
>> Signed-off-by: David Hildenbrand (Arm) <david@xxxxxxxxxx>
>> ---
>
> Might be bit late but FWIW...
Not at all, thanks!
--
Cheers,
David