Re: [PATCH v2 05/13] mm/slab: make slab_obj_ext() determine object index
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: > All callers perform the same obj_to_index() calculation to pass the > index. Simplify by passing object pointer instead and determining the > index by slab_obj_ext(). Nice! > Reviewed-by: Suren Baghdasaryan <[email protected]> > Signed-off-by: Vlastimil Babka (SUSE) <[email protected]> > --- Looks good to me, Reviewed-by: Harry Yoo (Oracle) <[email protected]> with a nit on typo below > mm/memcontrol.c | 12 +++--------- > mm/slab.h | 19 +++++++++++-------- > mm/slub.c | 22 +++++++--------------- > 3 files changed, 21 insertions(+), 32 deletions(-) > diff --git a/mm/slab.h b/mm/slab.h > index 7bd361447c54..64cec02b5016 100644 > --- a/mm/slab.h > +++ b/mm/slab.h > @@ -579,7 +579,7 @@ struct slabobj_ext { > * obj_exts = slab_obj_exts(slab); > * if (obj_exts) { > * get_slab_obj_exts(obj_exts); > - * obj_ext = slab_obj_ext(slab, obj_exts, obj_to_index(s, slab, obj)); > + * obj_ext = slab_obj_ext(s, slab, obj_exts, obj); > * // do something with obj_ext > * put_slab_obj_exts(obj_exts); > * } > @@ -639,21 +639,24 @@ static inline unsigned int slab_get_stride(struct slab *slab) > /* > * slab_obj_ext - get the pointer to the slab object extension metadata > * associated with an object in a slab. > + * @s: cache that the slab blongs to nit: blongs -> belongs > * @slab: a pointer to the slab struct > * @obj_exts: a pointer to the object extension vector > - * @index: an index of the object > + * @obj: a pointer to the object > * > * Returns a pointer to the object extension associated with the object. > * Must be called within a section covered by get/put_slab_obj_exts(). > */ > -static inline struct slabobj_ext *slab_obj_ext(struct slab *slab, > - unsigned long obj_exts, > - unsigned int index) -- Cheers, Harry / Hyeonggon
OpenPGP_signature.asc
(application/pgp-signature, 228 B)
-----BEGIN PGP SIGNATURE----- iHUEARYKAB0WIQQQ1ub6gR5ogjaKRmOGXBN6rc5S1gUCal8LdwAKCRCGXBN6rc5S 1saKAP0QWmanMNtSWcitc46wO43ObEN6jNyOb66yd+fWn/XwLgEAiqItNg9zJves jTKoV6pgZPlag6PNzqn5WPPHs+gXrw8= =GF5b -----END PGP SIGNATURE-----