Re: [PATCH 2/5] mm/khugepaged: use slab cache instead of normal kmalloc
From: Harry Yoo
Date: Thu Jun 11 2026 - 00:42:17 EST
On 6/11/26 12:16 PM, Luka Bai wrote:
> 在 Tue, Jun 09, 2026 at 12:26:18PM +0200,Vlastimil Babka (SUSE) 写道:
>> On 5/31/26 06:23, Luka Bai wrote:
>>> From: Luka Bai <lukabai@xxxxxxxxxxx>
>>>
>>> We added a kmem slab cached called collapse_hint_cache for
>>> khugepaged collapse hint, to improve the performance in allocation
>>> and freeing for the hint structs.
>>>
>>> Signed-off-by: Luka Bai <lukabai@xxxxxxxxxxx>
>>
>> Khugepaged isn't exactly a hotpath? Adding own cache comes with memory
>> overhead, so this doesn't seem like a sufficient reason to do that.
>>
> Hi Vlastimil,
>
> Thanks for the review :).
>
> Yeah Khugepaged is not a hotpath. But in my implementation we will allocate
> those khugepaged collapse hint structs in other paths like walk_mm() and
> lru_gen_look_around(), which may be called more frequently under memory
> pressure. I'm a little afraid that directly using kmalloc may compromise
> the performance of reclaimation... What do you think? Thanks. :)
What makes you think using kmalloc compromises the performance under
memory pressure?
> Best regards,
> Luka
--
Cheers,
Harry / Hyeonggon
Attachment:
OpenPGP_signature.asc
Description: OpenPGP digital signature