slab: Reuse first bit for OBJEXTS_ALLOC_FAIL

Since the combination of valid upper bits in slab->obj_exts with
OBJEXTS_ALLOC_FAIL bit can never happen,
use OBJEXTS_ALLOC_FAIL == (1ull << 0) as a magic sentinel
instead of (1ull << 2) to free up bit 2.

Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Shakeel Butt <shakeel.butt@linux.dev>
Reviewed-by: Harry Yoo <harry.yoo@oracle.com>
Signed-off-by: Vlastimil Babka <vbabka@suse.cz>
This commit is contained in:
Alexei Starovoitov 2025-09-08 18:00:06 -07:00 committed by Vlastimil Babka
parent 83382af9dd
commit 7612833192
2 changed files with 9 additions and 3 deletions

View File

@ -341,17 +341,23 @@ enum page_memcg_data_flags {
__NR_MEMCG_DATA_FLAGS = (1UL << 2), __NR_MEMCG_DATA_FLAGS = (1UL << 2),
}; };
#define __OBJEXTS_ALLOC_FAIL MEMCG_DATA_OBJEXTS
#define __FIRST_OBJEXT_FLAG __NR_MEMCG_DATA_FLAGS #define __FIRST_OBJEXT_FLAG __NR_MEMCG_DATA_FLAGS
#else /* CONFIG_MEMCG */ #else /* CONFIG_MEMCG */
#define __OBJEXTS_ALLOC_FAIL (1UL << 0)
#define __FIRST_OBJEXT_FLAG (1UL << 0) #define __FIRST_OBJEXT_FLAG (1UL << 0)
#endif /* CONFIG_MEMCG */ #endif /* CONFIG_MEMCG */
enum objext_flags { enum objext_flags {
/* slabobj_ext vector failed to allocate */ /*
OBJEXTS_ALLOC_FAIL = __FIRST_OBJEXT_FLAG, * Use bit 0 with zero other bits to signal that slabobj_ext vector
* failed to allocate. The same bit 0 with valid upper bits means
* MEMCG_DATA_OBJEXTS.
*/
OBJEXTS_ALLOC_FAIL = __OBJEXTS_ALLOC_FAIL,
/* the next bit after the last actual flag */ /* the next bit after the last actual flag */
__NR_OBJEXTS_FLAGS = (__FIRST_OBJEXT_FLAG << 1), __NR_OBJEXTS_FLAGS = (__FIRST_OBJEXT_FLAG << 1),
}; };

View File

@ -2046,7 +2046,7 @@ static inline void handle_failed_objexts_alloc(unsigned long obj_exts,
* objects with no tag reference. Mark all references in this * objects with no tag reference. Mark all references in this
* vector as empty to avoid warnings later on. * vector as empty to avoid warnings later on.
*/ */
if (obj_exts & OBJEXTS_ALLOC_FAIL) { if (obj_exts == OBJEXTS_ALLOC_FAIL) {
unsigned int i; unsigned int i;
for (i = 0; i < objects; i++) for (i = 0; i < objects; i++)