From b8af2820f6412e9775fba93f1224c54345a9346f Mon Sep 17 00:00:00 2001 From: Mateusz Guzik Date: Fri, 8 Jun 2018 05:40:36 +0000 Subject: [PATCH] uma: fix up r334824 Turns out there is code which ends up passing M_ZERO to counters. Since counters zero unconditionally on their own, just ignore drop the flag in that place. --- sys/kern/subr_counter.c | 2 +- sys/net/route.c | 2 +- sys/vm/uma_core.c | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/sys/kern/subr_counter.c b/sys/kern/subr_counter.c index d53ea8e804aa..3128356f3131 100644 --- a/sys/kern/subr_counter.c +++ b/sys/kern/subr_counter.c @@ -62,7 +62,7 @@ counter_u64_alloc(int flags) { counter_u64_t r; - r = uma_zalloc(pcpu_zone_64, flags); + r = uma_zalloc(pcpu_zone_64, flags & ~M_ZERO); if (r != NULL) counter_u64_zero(r); diff --git a/sys/net/route.c b/sys/net/route.c index 597e8e6646e3..06eaba334f3a 100644 --- a/sys/net/route.c +++ b/sys/net/route.c @@ -235,7 +235,7 @@ rtentry_zinit(void *mem, int size, int how) { struct rtentry *rt = mem; - rt->rt_pksent = counter_u64_alloc(how & ~M_ZERO); + rt->rt_pksent = counter_u64_alloc(how); if (rt->rt_pksent == NULL) return (ENOMEM); diff --git a/sys/vm/uma_core.c b/sys/vm/uma_core.c index e15d1e974dbf..8d3ac7ebc0c4 100644 --- a/sys/vm/uma_core.c +++ b/sys/vm/uma_core.c @@ -2257,7 +2257,8 @@ uma_zalloc_arg(uma_zone_t zone, void *udata, int flags) KASSERT(curthread->td_critnest == 0 || SCHEDULER_STOPPED(), ("uma_zalloc_arg: called with spinlock or critical section held")); if (zone->uz_flags & UMA_ZONE_PCPU) - MPASS((flags & M_ZERO) == 0); + KASSERT((flags & M_ZERO) == 0, ("allocating from a pcpu zone " + "with M_ZERO passed")); #ifdef DEBUG_MEMGUARD if (memguard_cmp_zone(zone)) {