Author: mjg
Date: Sun Jun 24 13:08:05 2018
New Revision: 335600
URL: https://svnweb.freebsd.org/changeset/base/335600

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

Modified:
  head/sys/vm/vm_radix.c

Modified: head/sys/vm/vm_radix.c
==============================================================================
--- head/sys/vm/vm_radix.c      Sun Jun 24 12:52:38 2018        (r335599)
+++ head/sys/vm/vm_radix.c      Sun Jun 24 13:08:05 2018        (r335600)
@@ -112,7 +112,7 @@ vm_radix_node_get(vm_pindex_t owner, uint16_t count, u
 {
        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, 
 }
 #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);
 }
 
 /*
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "[email protected]"

Reply via email to