svn commit: r340430 - head/contrib/jemalloc/src

Edward Tomasz Napierala trasz at FreeBSD.org
Wed Nov 14 13:06:50 UTC 2018


Author: trasz
Date: Wed Nov 14 13:06:48 2018
New Revision: 340430
URL: https://svnweb.freebsd.org/changeset/base/340430

Log:
  Pick 57553c3b1a5592dc4c03f3c6831d9b794e523865 from upstream:
  
      Avoid touching all pages in extent_recycle for debug build.
  
      We may have a large number of pages with *zero set (since they are populated on
      demand).  Only check the first page to avoid paging in all of them.
  
  This makes it easy to compare performance with and without 'retain:true'.
  
  Discussed with:	jasone
  Obtained from:	Qi Wang <interwq at gwu dot edu>
  MFC after:	2 weeks
  Sponsored by:	DARPA, AFRL

Modified:
  head/contrib/jemalloc/src/extent.c

Modified: head/contrib/jemalloc/src/extent.c
==============================================================================
--- head/contrib/jemalloc/src/extent.c	Wed Nov 14 09:06:15 2018	(r340429)
+++ head/contrib/jemalloc/src/extent.c	Wed Nov 14 13:06:48 2018	(r340430)
@@ -1113,14 +1113,15 @@ extent_recycle(tsdn_t *tsdn, arena_t *arena, extent_ho
 
 	if (*zero) {
 		void *addr = extent_base_get(extent);
-		size_t size = extent_size_get(extent);
 		if (!extent_zeroed_get(extent)) {
+			size_t size = extent_size_get(extent);
 			if (pages_purge_forced(addr, size)) {
 				memset(addr, 0, size);
 			}
 		} else if (config_debug) {
 			size_t *p = (size_t *)(uintptr_t)addr;
-			for (size_t i = 0; i < size / sizeof(size_t); i++) {
+			/* Check the first page only. */
+			for (size_t i = 0; i < PAGE / sizeof(size_t); i++) {
 				assert(p[i] == 0);
 			}
 		}


More information about the svn-src-head mailing list