mirror of
https://github.com/torvalds/linux.git
synced 2026-09-11 20:13:02 +02:00
mm/mm_slot.h: add comments for mm_slot_lookup/insert
mm_slot_lookup() and mm_slot_insert() are the only helpers in this header that are implemented as macros rather than static inline functions. This may look inconsistent without explanation. Explain they must be macros because hash_for_each_possible() needs the table as an array (for sizeof), not a pointer. Link: https://lore.kernel.org/20260714092815120Wv-CFDlLKtsTmda--97Qw@zte.com.cn Signed-off-by: xu xin <xu.xin16@zte.com.cn> Reviewed-by: Barry Song <baohua@kernel.org> Acked-by: David Hildenbrand (Arm) <david@kernel.org> Reviewed-by: Qi Zheng <qi.zheng@linux.dev> Reviewed-by: Lorenzo Stoakes (ARM) <ljs@kernel.org> Reviewed-by: SJ Park <sj@kernel.org> Reviewed-by: Zi Yan <ziy@nvidia.com> Cc: Baolin Wang <baolin.wang@linux.alibaba.com> Cc: Chengming Zhou <chengming.zhou@linux.dev> Cc: Dev Jain <dev.jain@arm.com> Cc: Lance Yang <lance.yang@linux.dev> Cc: Nico Pache <npache@redhat.com> Cc: Ryan Roberts <ryan.roberts@arm.com> Cc: Wang Yaxin <wang.yaxin@zte.com.cn> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
This commit is contained in:
parent
eed8da1ff6
commit
5c3746a0fe
|
|
@ -33,6 +33,12 @@ static inline void mm_slot_free(struct kmem_cache *cache, void *objp)
|
|||
kmem_cache_free(cache, objp);
|
||||
}
|
||||
|
||||
/*
|
||||
* Note: mm_slot_lookup and mm_slot_insert cannot be converted to static inline
|
||||
* functions because the hash helpers (hash_for_each_possible and hash_add) rely
|
||||
* on the actual array argument 'hashtable' for sizeof() instead of pointers.
|
||||
*/
|
||||
|
||||
#define mm_slot_lookup(_hashtable, _mm) \
|
||||
({ \
|
||||
struct mm_slot *tmp_slot, *mm_slot = NULL; \
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user