git: c5cf4b64f4a9 - main - malloc: extend malloc_usable_size() for contigmalloc
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 12 Apr 2025 20:49:40 UTC
The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=c5cf4b64f4a976f5c5d75d52816078def86bf3e4 commit c5cf4b64f4a976f5c5d75d52816078def86bf3e4 Author: Bjoern A. Zeeb <bz@FreeBSD.org> AuthorDate: 2025-04-12 17:11:26 +0000 Commit: Bjoern A. Zeeb <bz@FreeBSD.org> CommitDate: 2025-04-12 20:49:19 +0000 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: 9e6544dd6e02 Differential Revision: https://reviews.freebsd.org/D49571 --- sys/kern/kern_malloc.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sys/kern/kern_malloc.c b/sys/kern/kern_malloc.c index 0b76e633b04a..879220be050b 100644 --- a/sys/kern/kern_malloc.c +++ b/sys/kern/kern_malloc.c @@ -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;