Author: mjg
Date: Fri Jun  8 05:40:36 2018
New Revision: 334830
URL: https://svnweb.freebsd.org/changeset/base/334830

Log:
  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.

Modified:
  head/sys/kern/subr_counter.c
  head/sys/net/route.c
  head/sys/vm/uma_core.c

Modified: head/sys/kern/subr_counter.c
==============================================================================
--- head/sys/kern/subr_counter.c        Fri Jun  8 05:17:06 2018        
(r334829)
+++ head/sys/kern/subr_counter.c        Fri Jun  8 05:40:36 2018        
(r334830)
@@ -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);
 

Modified: head/sys/net/route.c
==============================================================================
--- head/sys/net/route.c        Fri Jun  8 05:17:06 2018        (r334829)
+++ head/sys/net/route.c        Fri Jun  8 05:40:36 2018        (r334830)
@@ -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);
 

Modified: head/sys/vm/uma_core.c
==============================================================================
--- head/sys/vm/uma_core.c      Fri Jun  8 05:17:06 2018        (r334829)
+++ head/sys/vm/uma_core.c      Fri Jun  8 05:40:36 2018        (r334830)
@@ -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)) {
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to