Message ID | 20220304063427.372145-4-42.hyeyoo@gmail.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | slab cleanups | expand |
On 3/4/22 07:34, Hyeonggon Yoo wrote: > __ksize() is only called by KASAN. Remove export symbol and move > definition to mm/slab.h as we don't want to grow its callers. > > [ willy@infradead.org: Move definition to mm/slab.h and reduce comments ] > > Signed-off-by: Hyeonggon Yoo <42.hyeyoo@gmail.com> Reviewed-by: Vlastimil Babka <vbabka@suse.cz> > --- a/mm/slab.h > +++ b/mm/slab.h > @@ -685,6 +685,8 @@ static inline void free_large_kmalloc(struct folio *folio, void *object) > } > #endif /* CONFIG_SLOB */ > > +size_t __ksize(const void *objp); > + > static inline size_t slab_ksize(const struct kmem_cache *s) > { > #ifndef CONFIG_SLUB > diff --git a/mm/slab_common.c b/mm/slab_common.c > index 1d2f92e871d2..b126fc7247b9 100644 > --- a/mm/slab_common.c > +++ b/mm/slab_common.c > @@ -1247,13 +1247,7 @@ EXPORT_SYMBOL(kfree_sensitive); > > #ifndef CONFIG_SLOB > /** Maybe just /* so it's not even parsed as a kernel-doc anymore? > - * __ksize -- Uninstrumented ksize. > - * @objp: pointer to the object > - * > - * Unlike ksize(), __ksize() is uninstrumented, and does not provide the same > - * safety checks as ksize() with KASAN instrumentation enabled. > - * > - * Return: size of the actual memory used by @objp in bytes > + * __ksize -- Uninstrumented ksize. Only called by KASAN. > */ > size_t __ksize(const void *object) > { > @@ -1269,7 +1263,6 @@ size_t __ksize(const void *object) > > return slab_ksize(folio_slab(folio)->slab_cache); > } > -EXPORT_SYMBOL(__ksize); > #endif >
On Fri, Mar 04, 2022 at 07:29:21PM +0100, Vlastimil Babka wrote: > On 3/4/22 07:34, Hyeonggon Yoo wrote: > > __ksize() is only called by KASAN. Remove export symbol and move > > definition to mm/slab.h as we don't want to grow its callers. > > > > [ willy@infradead.org: Move definition to mm/slab.h and reduce comments ] > > > > Signed-off-by: Hyeonggon Yoo <42.hyeyoo@gmail.com> > > Reviewed-by: Vlastimil Babka <vbabka@suse.cz> > Thanks! > > --- a/mm/slab.h > > +++ b/mm/slab.h > > @@ -685,6 +685,8 @@ static inline void free_large_kmalloc(struct folio *folio, void *object) > > } > > #endif /* CONFIG_SLOB */ > > > > +size_t __ksize(const void *objp); > > + > > static inline size_t slab_ksize(const struct kmem_cache *s) > > { > > #ifndef CONFIG_SLUB > > diff --git a/mm/slab_common.c b/mm/slab_common.c > > index 1d2f92e871d2..b126fc7247b9 100644 > > --- a/mm/slab_common.c > > +++ b/mm/slab_common.c > > @@ -1247,13 +1247,7 @@ EXPORT_SYMBOL(kfree_sensitive); > > > > #ifndef CONFIG_SLOB > > /** > > Maybe just /* so it's not even parsed as a kernel-doc anymore? > Oh yes, that would be better. > > - * __ksize -- Uninstrumented ksize. > > - * @objp: pointer to the object > > - * > > - * Unlike ksize(), __ksize() is uninstrumented, and does not provide the same > > - * safety checks as ksize() with KASAN instrumentation enabled. > > - * > > - * Return: size of the actual memory used by @objp in bytes > > + * __ksize -- Uninstrumented ksize. Only called by KASAN. > > */ > > size_t __ksize(const void *object) > > { > > @@ -1269,7 +1263,6 @@ size_t __ksize(const void *object) > > > > return slab_ksize(folio_slab(folio)->slab_cache); > > } > > -EXPORT_SYMBOL(__ksize); > > #endif > >
diff --git a/include/linux/slab.h b/include/linux/slab.h index e7b3330db4f3..d2b896553315 100644 --- a/include/linux/slab.h +++ b/include/linux/slab.h @@ -182,7 +182,6 @@ int kmem_cache_shrink(struct kmem_cache *s); void * __must_check krealloc(const void *objp, size_t new_size, gfp_t flags) __alloc_size(2); void kfree(const void *objp); void kfree_sensitive(const void *objp); -size_t __ksize(const void *objp); size_t ksize(const void *objp); #ifdef CONFIG_PRINTK bool kmem_valid_obj(void *object); diff --git a/mm/slab.h b/mm/slab.h index 31e98beb47a3..79b319d58504 100644 --- a/mm/slab.h +++ b/mm/slab.h @@ -685,6 +685,8 @@ static inline void free_large_kmalloc(struct folio *folio, void *object) } #endif /* CONFIG_SLOB */ +size_t __ksize(const void *objp); + static inline size_t slab_ksize(const struct kmem_cache *s) { #ifndef CONFIG_SLUB diff --git a/mm/slab_common.c b/mm/slab_common.c index 1d2f92e871d2..b126fc7247b9 100644 --- a/mm/slab_common.c +++ b/mm/slab_common.c @@ -1247,13 +1247,7 @@ EXPORT_SYMBOL(kfree_sensitive); #ifndef CONFIG_SLOB /** - * __ksize -- Uninstrumented ksize. - * @objp: pointer to the object - * - * Unlike ksize(), __ksize() is uninstrumented, and does not provide the same - * safety checks as ksize() with KASAN instrumentation enabled. - * - * Return: size of the actual memory used by @objp in bytes + * __ksize -- Uninstrumented ksize. Only called by KASAN. */ size_t __ksize(const void *object) { @@ -1269,7 +1263,6 @@ size_t __ksize(const void *object) return slab_ksize(folio_slab(folio)->slab_cache); } -EXPORT_SYMBOL(__ksize); #endif /** diff --git a/mm/slob.c b/mm/slob.c index 60c5842215f1..d8af6c54f133 100644 --- a/mm/slob.c +++ b/mm/slob.c @@ -588,7 +588,6 @@ size_t __ksize(const void *block) m = (unsigned int *)(block - align); return SLOB_UNITS(*m) * SLOB_UNIT; } -EXPORT_SYMBOL(__ksize); int __kmem_cache_create(struct kmem_cache *c, slab_flags_t flags) {
__ksize() is only called by KASAN. Remove export symbol and move definition to mm/slab.h as we don't want to grow its callers. [ willy@infradead.org: Move definition to mm/slab.h and reduce comments ] Signed-off-by: Hyeonggon Yoo <42.hyeyoo@gmail.com> --- include/linux/slab.h | 1 - mm/slab.h | 2 ++ mm/slab_common.c | 9 +-------- mm/slob.c | 1 - 4 files changed, 3 insertions(+), 10 deletions(-)