svn commit: r357018 - head/sys/vm

Ryan Libby rlibby at FreeBSD.org
Thu Jan 23 04:56:35 UTC 2020


Author: rlibby
Date: Thu Jan 23 04:56:34 2020
New Revision: 357018
URL: https://svnweb.freebsd.org/changeset/base/357018

Log:
  uma: report leaks more accurately
  
  Previously UMA had some false negatives in the leak report at keg
  destruction time, where it only reported leaks if there were free items
  in the slab layer (rather than allocated items), which notably would not
  be true for single-item slabs (large items).  Now, report a leak if
  there are any allocated pages, and calculate and report the number of
  allocated items rather than free items.
  
  Reviewed by:	jeff, markj
  Sponsored by:	Dell EMC Isilon
  Differential Revision:	https://reviews.freebsd.org/D23275

Modified:
  head/sys/vm/uma_core.c

Modified: head/sys/vm/uma_core.c
==============================================================================
--- head/sys/vm/uma_core.c	Thu Jan 23 04:54:49 2020	(r357017)
+++ head/sys/vm/uma_core.c	Thu Jan 23 04:56:34 2020	(r357018)
@@ -2440,11 +2440,11 @@ keg_dtor(void *arg, int size, void *udata)
 		pages += keg->uk_domain[i].ud_pages;
 		KEG_LOCK_FINI(keg, i);
 	}
-	if (free != 0)
+	if (pages != 0)
 		printf("Freed UMA keg (%s) was not empty (%u items). "
 		    " Lost %u pages of memory.\n",
 		    keg->uk_name ? keg->uk_name : "",
-		    free, pages);
+		    pages / keg->uk_ppera * keg->uk_ipers - free, pages);
 
 	hash_free(&keg->uk_hash);
 }


More information about the svn-src-head mailing list