Re: [PATCH v2 02/13] mm/slub: skip handle_failed_objexts_alloc() with profiling disabled
Harry Yoo <[email protected]>
| Newsgroups | org.kernel.vger.cgroups,org.kernel.vger.linux-kernel,org.kvack.linux-mm |
|---|---|
| Message-ID | <[email protected]> |
On 7/20/26 11:16 PM, Vlastimil Babka (SUSE) wrote: > The function might get called with memory allocation profiling disabled, > when the obj_ext array is allocated for objcg pointers only. The > handling is however unnecessary in that case, so skip it. > > This would otherwise become a real bug later, as pointed out by sashiko. > For now it's just an optimization. > > Link: https://sashiko.dev/#/patchset/[email protected]?part=10 > Signed-off-by: Vlastimil Babka (SUSE) <[email protected]> > --- > mm/slub.c | 7 ++++--- > 1 file changed, 4 insertions(+), 3 deletions(-) > > diff --git a/mm/slub.c b/mm/slub.c > index 76acb78f2655..95fa6fbad11a 100644 > --- a/mm/slub.c > +++ b/mm/slub.c > @@ -2101,15 +2101,16 @@ static inline bool mark_failed_objexts_alloc(struct slab *slab) > static inline void handle_failed_objexts_alloc(unsigned long obj_exts, > struct slabobj_ext *vec, unsigned int objects) > { > + if (!mem_alloc_profiling_enabled()) > + return; This looks racy. Can we instead do this later in the series depending on slab_obj_ext_has_codetag_key's value? > /* > * If vector previously failed to allocate then we have live > * objects with no tag reference. Mark all references in this > * vector as empty to avoid warnings later on. > */ > if (obj_exts == OBJEXTS_ALLOC_FAIL) { > - unsigned int i; > - > - for (i = 0; i < objects; i++) > + for (unsigned int i = 0; i < objects; i++) > set_codetag_empty(&vec[i].ref); > } > } > -- Cheers, Harry / Hyeonggon
OpenPGP_signature.asc
(application/pgp-signature, 228 B)
-----BEGIN PGP SIGNATURE----- iHUEARYKAB0WIQQQ1ub6gR5ogjaKRmOGXBN6rc5S1gUCal8I4wAKCRCGXBN6rc5S 1uOkAP9JyWOEjPrnydpu0m5kMCD3Jg/w8yVhPqbOK9JF7RPdDAD+IA96fpIdRg7l Iwl53sgc1cby3TLJcQjYVOaHX6xsSQY= =FTDG -----END PGP SIGNATURE-----