malloc: extend malloc_usable_size() for contigmalloc

Extend malloc_usable_size() for contigmalloc;  it seems the only
outside consumer is LinuxKPI ksize() which by itself has little to
no consumer either.

Sponsored by:   The FreeBSD Foundation
MFC after:      3 days
Suggested by:   jhb (see D46657)
Reviewed by:    jhb, markj
Fixes:		9e6544dd6e
Differential Revision: https://reviews.freebsd.org/D49571
This commit is contained in:
Bjoern A. Zeeb 2025-04-12 17:11:26 +00:00
parent 1c81ebec74
commit c5cf4b64f4

View file

@ -1142,6 +1142,9 @@ malloc_usable_size(const void *addr)
case SLAB_COOKIE_MALLOC_LARGE:
size = malloc_large_size(slab);
break;
case SLAB_COOKIE_CONTIG_MALLOC:
size = round_page(contigmalloc_size(slab));
break;
default:
__assert_unreachable();
size = 0;