Re: [PATCH v2 1/2] mm/mm_slot.h: add a helper function mm_slot_remove
From: SJ Park
Date: Mon Jul 13 2026 - 20:16:57 EST
On Mon, 13 Jul 2026 14:37:07 +0800 (CST) <xu.xin16@xxxxxxxxxx> wrote:
> From: xu xin <xu.xin16@xxxxxxxxxx>
>
> Both THP and KSM manage per-mm scanning slots using the mm_slot
> structure. The slot is kept in a hash table and a list, and removal from
> both containers requires the same two operations: hash_del() and
> list_del().
>
> Introduce mm_slot_remove() to abstract the common hash_del() + list_del()
> sequence used in both khugepaged and KSM.
>
> No functional change is intended.
Looks good and clean to me!
>
> Signed-off-by: xu xin <xu.xin16@xxxxxxxxxx>
Reviewed-by: SJ Park <sj@xxxxxxxxxx>
[...]
> --- a/mm/mm_slot.h
> +++ b/mm/mm_slot.h
> @@ -52,4 +52,9 @@ static inline void mm_slot_free(struct kmem_cache *cache, void *objp)
> hash_add(_hashtable, &_mm_slot->hash, (unsigned long)_mm); \
> })
>
> +static inline void mm_slot_remove(struct mm_slot *slot)
> +{
> + hash_del(&slot->hash);
> + list_del(&slot->mm_node);
> +}
> #endif /* _LINUX_MM_SLOT_H */
I'd prefer keep having the one blank line bfore the #endif. Definitely not a
blocker but just thinking loud.
Thanks,
SJ
[...]