Change malloc_domain() to return the allocation size to the caller.
Otherwise the malloc type accounting in malloc_domainset(9) is wrong after r355203. Reviewed by: rlibby Reported by: kaktus Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D23095
This commit is contained in:
parent
c23df8eafa
commit
dc727127f1
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=356555
@ -652,13 +652,15 @@ void *
|
||||
}
|
||||
|
||||
static void *
|
||||
malloc_domain(size_t size, int *indxp, struct malloc_type *mtp, int domain,
|
||||
malloc_domain(size_t *sizep, int *indxp, struct malloc_type *mtp, int domain,
|
||||
int flags)
|
||||
{
|
||||
int indx;
|
||||
caddr_t va;
|
||||
uma_zone_t zone;
|
||||
caddr_t va;
|
||||
size_t size;
|
||||
int indx;
|
||||
|
||||
size = *sizep;
|
||||
KASSERT(size <= kmem_zmax && (flags & M_EXEC) == 0,
|
||||
("malloc_domain: Called with bad flag / size combination."));
|
||||
if (size & KMEM_ZMASK)
|
||||
@ -670,10 +672,9 @@ malloc_domain(size_t size, int *indxp, struct malloc_type *mtp, int domain,
|
||||
#endif
|
||||
va = uma_zalloc_domain(zone, NULL, domain, flags);
|
||||
if (va != NULL)
|
||||
size = zone->uz_size;
|
||||
*sizep = zone->uz_size;
|
||||
*indxp = indx;
|
||||
|
||||
return ((void *) va);
|
||||
return ((void *)va);
|
||||
}
|
||||
|
||||
void *
|
||||
@ -696,7 +697,7 @@ malloc_domainset(size_t size, struct malloc_type *mtp, struct domainset *ds,
|
||||
if (size <= kmem_zmax && (flags & M_EXEC) == 0) {
|
||||
vm_domainset_iter_policy_init(&di, ds, &domain, &flags);
|
||||
do {
|
||||
ret = malloc_domain(size, &indx, mtp, domain, flags);
|
||||
ret = malloc_domain(&size, &indx, mtp, domain, flags);
|
||||
} while (ret == NULL &&
|
||||
vm_domainset_iter_policy(&di, &domain) == 0);
|
||||
malloc_type_zone_allocated(mtp, ret == NULL ? 0 : size, indx);
|
||||
|
Loading…
Reference in New Issue
Block a user