vm: stop passing M_ZERO when allocating radix nodes

Allocation explicitely initialized the 3 leading fields. The rest is an
array which is supposed to be NULL-ed prior to deallocation.

Delegate zeroing to the infrequently called object initializator.

This gets rid of one of the most common memset consumers.

Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D15989
This commit is contained in:
mjg 2018-06-24 13:08:05 +00:00
parent 21654320c9
commit 77b94e2841

View File

@ -112,7 +112,7 @@ vm_radix_node_get(vm_pindex_t owner, uint16_t count, uint16_t clevel)
{
struct vm_radix_node *rnode;
rnode = uma_zalloc(vm_radix_node_zone, M_NOWAIT | M_ZERO);
rnode = uma_zalloc(vm_radix_node_zone, M_NOWAIT);
if (rnode == NULL)
return (NULL);
rnode->rn_owner = owner;
@ -283,6 +283,16 @@ vm_radix_node_zone_dtor(void *mem, int size __unused, void *arg __unused)
}
#endif
static int
vm_radix_node_zone_init(void *mem, int size __unused, int flags __unused)
{
struct vm_radix_node *rnode;
rnode = mem;
bzero(rnode, sizeof(*rnode));
return (0);
}
#ifndef UMA_MD_SMALL_ALLOC
void vm_radix_reserve_kva(void);
/*
@ -321,7 +331,7 @@ vm_radix_zinit(void)
#else
NULL,
#endif
NULL, NULL, VM_RADIX_PAD, UMA_ZONE_VM);
vm_radix_node_zone_init, NULL, VM_RADIX_PAD, UMA_ZONE_VM);
}
/*