Re: [PATCH 1/5] Revert "mm/khugepaged: remove definition of struct khugepaged_mm_slot"
From: Lance Yang
Date: Wed Nov 04 2026 - 02:46:52 EST
On Tue, Nov 03, 2026 at 08:27:42AM +0000, Lorenzo Stoakes (ARM) wrote:
>This partially reverts commit b4c9ffb54b32 ("mm/khugepaged: remove
>definition of struct khugepaged_mm_slot"), as a subsequent commit needs to
>resurrect this type to store additional data alongside the mm_slot.
>
>The stated intent of the commit was to address a NULL check in
>__khugepaged_exit():
>
> mm_slot = mm_slot_entry(slot, struct khugepaged_mm_slot, slot);
>
>slot can be NULL and mm_slot_entry() is an alias for container_of(), so
>this is container_of() a NULL value.
>
>This was benign as there was only 1 field in khugepaged_mm_slot (offsetting
>NULL at 0 results in NULL), however it was right to fix this, so retain the
>fix.
>
>It also unwrapped KMEM_CACHE() in khugepaged_init(). This was a mistake,
>and was itself reverted in commit c14bdcc9f274 ("mm/khugepaged: use
>KMEM_CACHE()"). Therefore, retain the KMEM_CACHE() form in this revert.
>
>Signed-off-by: Lorenzo Stoakes (ARM) <ljs@xxxxxxxxxx>
>---
With patch #02 adding a per-mm scan position, bringing khugepaged_mm_slot
back looks reasonable to me ;)
Reviewed-by: Lance Yang <lance.yang@xxxxxxxxx>