1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-21 11:13:30 +00:00

Make M_ZERO flag work correctly on UMA_ZONE_PCPU zones.

Sponsored by:	Nginx, Inc.
This commit is contained in:
Gleb Smirnoff 2014-02-10 19:48:26 +00:00
parent 9188e408cc
commit 48343a2f34
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=261723

View File

@ -267,6 +267,7 @@ static uma_keg_t uma_kcreate(uma_zone_t zone, size_t size, uma_init uminit,
uma_fini fini, int align, uint32_t flags);
static int zone_import(uma_zone_t zone, void **bucket, int max, int flags);
static void zone_release(uma_zone_t zone, void **bucket, int cnt);
static void uma_zero_item(void *item, uma_zone_t zone);
void uma_print_zone(uma_zone_t);
void uma_print_stats(void);
@ -2170,7 +2171,7 @@ uma_zalloc_arg(uma_zone_t zone, void *udata, int flags)
uma_dbg_alloc(zone, NULL, item);
#endif
if (flags & M_ZERO)
bzero(item, zone->uz_size);
uma_zero_item(item, zone);
return (item);
}
@ -2620,7 +2621,7 @@ zone_alloc_item(uma_zone_t zone, void *udata, int flags)
uma_dbg_alloc(zone, NULL, item);
#endif
if (flags & M_ZERO)
bzero(item, zone->uz_size);
uma_zero_item(item, zone);
return (item);
@ -3237,6 +3238,17 @@ uma_large_free(uma_slab_t slab)
zone_free_item(slabzone, slab, NULL, SKIP_NONE);
}
static void
uma_zero_item(void *item, uma_zone_t zone)
{
if (zone->uz_flags & UMA_ZONE_PCPU) {
for (int i = 0; i < mp_ncpus; i++)
bzero(zpcpu_get_cpu(item, i), zone->uz_size);
} else
bzero(item, zone->uz_size);
}
void
uma_print_stats(void)
{