Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 24 Jun 2018 13:08:05 +0000 (UTC)
From:      Mateusz Guzik <mjg@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r335600 - head/sys/vm
Message-ID:  <201806241308.w5OD85Kg027622@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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);
 }
 
 /*



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201806241308.w5OD85Kg027622>