svn commit: r356353 - head/sys/vm
Jeff Roberson
jeff at FreeBSD.org
Sat Jan 4 19:29:26 UTC 2020
Author: jeff
Date: Sat Jan 4 19:29:25 2020
New Revision: 356353
URL: https://svnweb.freebsd.org/changeset/base/356353
Log:
Fix an assertion introduced in r356348. On architectures without
UMA_MD_SMALL_ALLOC vmem has a more complicated startup sequence that
violated the new assert. Resolve this by rewriting the COLD asserts to
look at the per-cpu allocation counts for evidence of api activity.
Discussed with: rlibby
Reviewed by: markj
Reported by: lwhsu
Modified:
head/sys/vm/uma_core.c
head/sys/vm/uma_int.h
Modified: head/sys/vm/uma_core.c
==============================================================================
--- head/sys/vm/uma_core.c Sat Jan 4 18:59:46 2020 (r356352)
+++ head/sys/vm/uma_core.c Sat Jan 4 19:29:25 2020 (r356353)
@@ -294,7 +294,10 @@ static int sysctl_handle_uma_zone_flags(SYSCTL_HANDLER
static int sysctl_handle_uma_slab_efficiency(SYSCTL_HANDLER_ARGS);
static int sysctl_handle_uma_zone_items(SYSCTL_HANDLER_ARGS);
+static uint64_t uma_zone_get_allocs(uma_zone_t zone);
+
#ifdef INVARIANTS
+static uint64_t uma_keg_get_allocs(uma_keg_t zone);
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);
@@ -4184,6 +4187,22 @@ uma_zone_get_frees(uma_zone_t zone)
return (nitems);
}
+
+#ifdef INVARIANTS
+/* Used only for KEG_ASSERT_COLD(). */
+static uint64_t
+uma_keg_get_allocs(uma_keg_t keg)
+{
+ uma_zone_t z;
+ uint64_t nitems;
+
+ nitems = 0;
+ LIST_FOREACH(z, &keg->uk_zones, uz_link)
+ nitems += uma_zone_get_allocs(z);
+
+ return (nitems);
+}
+#endif
/* See uma.h */
void
Modified: head/sys/vm/uma_int.h
==============================================================================
--- head/sys/vm/uma_int.h Sat Jan 4 18:59:46 2020 (r356352)
+++ head/sys/vm/uma_int.h Sat Jan 4 19:29:25 2020 (r356353)
@@ -305,7 +305,7 @@ typedef struct uma_keg * uma_keg_t;
#ifdef _KERNEL
#define KEG_ASSERT_COLD(k) \
- KASSERT((k)->uk_domain[0].ud_pages == 0, \
+ KASSERT(uma_keg_get_allocs((k)) == 0, \
("keg %s initialization after use.", (k)->uk_name))
/*
@@ -529,7 +529,7 @@ struct uma_zone {
#define UZ_ITEMS_SLEEPER (1LL << UZ_ITEMS_SLEEPER_SHIFT)
#define ZONE_ASSERT_COLD(z) \
- KASSERT((z)->uz_bkt_count == 0, \
+ KASSERT(uma_zone_get_allocs((z)) == 0, \
("zone %s initialization after use.", (z)->uz_name))
#undef UMA_ALIGN
More information about the svn-src-all
mailing list