Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 13 Dec 2019 11:21:29 +0000 (UTC)
From:      Ryan Libby <rlibby@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r355711 - in head: lib/libmemstat sys/vm
Message-ID:  <201912131121.xBDBLTTZ074931@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: rlibby
Date: Fri Dec 13 11:21:28 2019
New Revision: 355711
URL: https://svnweb.freebsd.org/changeset/base/355711

Log:
  Revert r355706 & r355710
  
  The quick fix didn't work.  I'll sort it out tomorrow.
  
  Revert r355710: "libmemstat: unbreak build"
  Revert r355706: "uma dbg: flexible size for slab debug bitset too"

Modified:
  head/lib/libmemstat/memstat_uma.c
  head/sys/vm/uma_core.c
  head/sys/vm/uma_int.h

Modified: head/lib/libmemstat/memstat_uma.c
==============================================================================
--- head/lib/libmemstat/memstat_uma.c	Fri Dec 13 10:34:19 2019	(r355710)
+++ head/lib/libmemstat/memstat_uma.c	Fri Dec 13 11:21:28 2019	(r355711)
@@ -31,7 +31,6 @@
 #include <sys/param.h>
 #include <sys/counter.h>
 #include <sys/cpuset.h>
-#include <sys/stddef.h>
 #include <sys/sysctl.h>
 
 #include <vm/uma.h>

Modified: head/sys/vm/uma_core.c
==============================================================================
--- head/sys/vm/uma_core.c	Fri Dec 13 10:34:19 2019	(r355710)
+++ head/sys/vm/uma_core.c	Fri Dec 13 11:21:28 2019	(r355711)
@@ -293,8 +293,6 @@ static int sysctl_handle_uma_zone_flags(SYSCTL_HANDLER
 static int sysctl_handle_uma_slab_efficiency(SYSCTL_HANDLER_ARGS);
 
 #ifdef INVARIANTS
-static inline struct noslabbits *slab_dbg_bits(uma_slab_t slab, uma_keg_t keg);
-
 static bool uma_dbg_kskip(uma_keg_t keg, void *mem);
 static bool uma_dbg_zskip(uma_zone_t zone, void *mem);
 static void uma_dbg_free(uma_zone_t zone, uma_slab_t slab, void *item);
@@ -1206,7 +1204,7 @@ keg_alloc_slab(uma_keg_t keg, uma_zone_t zone, int dom
 	slab->us_domain = domain;
 	BIT_FILL(keg->uk_ipers, &slab->us_free);
 #ifdef INVARIANTS
-	BIT_ZERO(keg->uk_ipers, slab_dbg_bits(slab, keg));
+	BIT_ZERO(SLAB_MAX_SETSIZE, &slab->us_debugfree);
 #endif
 
 	if (keg->uk_init != NULL) {
@@ -1489,15 +1487,6 @@ zero_init(void *mem, int size, int flags)
 	return (0);
 }
 
-#ifdef INVARIANTS
-struct noslabbits *
-slab_dbg_bits(uma_slab_t slab, uma_keg_t keg)
-{
-
-	return ((void *)((char *)&slab->us_free + BITSET_SIZE(keg->uk_ipers)));
-}
-#endif
-
 /*
  * Actual size of embedded struct slab (!OFFPAGE).
  */
@@ -1506,7 +1495,7 @@ slab_sizeof(int nitems)
 {
 	size_t s;
 
-	s = sizeof(struct uma_slab) + BITSET_SIZE(nitems) * SLAB_BITSETS;
+	s = sizeof(struct uma_slab) + BITSET_SIZE(nitems);
 	return (roundup(s, UMA_ALIGN_PTR + 1));
 }
 
@@ -4552,10 +4541,12 @@ uma_dbg_alloc(uma_zone_t zone, uma_slab_t slab, void *
 	keg = zone->uz_keg;
 	freei = slab_item_index(slab, keg, item);
 
-	if (BIT_ISSET(keg->uk_ipers, freei, slab_dbg_bits(slab, keg)))
+	if (BIT_ISSET(SLAB_MAX_SETSIZE, freei, &slab->us_debugfree))
 		panic("Duplicate alloc of %p from zone %p(%s) slab %p(%d)\n",
 		    item, zone, zone->uz_name, slab, freei);
-	BIT_SET_ATOMIC(keg->uk_ipers, freei, slab_dbg_bits(slab, keg));
+	BIT_SET_ATOMIC(SLAB_MAX_SETSIZE, freei, &slab->us_debugfree);
+
+	return;
 }
 
 /*
@@ -4586,11 +4577,11 @@ uma_dbg_free(uma_zone_t zone, uma_slab_t slab, void *i
 		panic("Unaligned free of %p from zone %p(%s) slab %p(%d)\n",
 		    item, zone, zone->uz_name, slab, freei);
 
-	if (!BIT_ISSET(keg->uk_ipers, freei, slab_dbg_bits(slab, keg)))
+	if (!BIT_ISSET(SLAB_MAX_SETSIZE, freei, &slab->us_debugfree))
 		panic("Duplicate free of %p from zone %p(%s) slab %p(%d)\n",
 		    item, zone, zone->uz_name, slab, freei);
 
-	BIT_CLR_ATOMIC(keg->uk_ipers, freei, slab_dbg_bits(slab, keg));
+	BIT_CLR_ATOMIC(SLAB_MAX_SETSIZE, freei, &slab->us_debugfree);
 }
 #endif /* INVARIANTS */
 

Modified: head/sys/vm/uma_int.h
==============================================================================
--- head/sys/vm/uma_int.h	Fri Dec 13 10:34:19 2019	(r355710)
+++ head/sys/vm/uma_int.h	Fri Dec 13 11:21:28 2019	(r355711)
@@ -271,26 +271,17 @@ struct uma_slab {
 	uint16_t	us_freecount;		/* How many are free? */
 	uint8_t		us_flags;		/* Page flags see uma.h */
 	uint8_t		us_domain;		/* Backing NUMA domain. */
-	struct noslabbits us_free;		/* Free bitmask, flexible. */
+#ifdef INVARIANTS
+	struct slabbits	us_debugfree;		/* Debug bitmask. */
+#endif
+	struct noslabbits us_free;		/* Free bitmask. */
 };
-_Static_assert(sizeof(struct uma_slab) == offsetof(struct uma_slab, us_free),
-    "us_free field must be last");
 #if MAXMEMDOM >= 255
 #error "Slab domain type insufficient"
 #endif
 
 typedef struct uma_slab * uma_slab_t;
 
-/*
- * On INVARIANTS builds, the slab contains a second bitset of the same size,
- * "dbg_bits", which is laid out immediately after us_free.
- */
-#ifdef INVARIANTS
-#define	SLAB_BITSETS	2
-#else
-#define	SLAB_BITSETS	1
-#endif
-
 /* These three functions are for embedded (!OFFPAGE) use only. */
 size_t slab_sizeof(int nitems);
 size_t slab_space(int nitems);
@@ -302,10 +293,7 @@ int slab_ipers(size_t size, int align);
  */
 struct uma_hash_slab {
 	struct uma_slab		uhs_slab;	/* Must be first. */
-	struct slabbits		uhs_bits1;	/* Must be second. */
-#ifdef INVARIANTS
-	struct slabbits		uhs_bits2;	/* Must be third. */
-#endif
+	struct slabbits		uhs_bits;	/* Must be second. */
 	LIST_ENTRY(uma_hash_slab) uhs_hlink;	/* Link for hash table */
 	uint8_t			*uhs_data;	/* First item */
 };



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