aboutsummaryrefslogtreecommitdiff
path: root/sys/sys/pcpu.h
diff options
context:
space:
mode:
authorKonstantin Belousov <kib@FreeBSD.org>2018-07-06 19:48:47 +0000
committerKonstantin Belousov <kib@FreeBSD.org>2018-07-06 19:48:47 +0000
commit16147166550303ef4e55db8ebea57df6e7caeba7 (patch)
tree63b869e2a6b87a9a927f5f29e590f918e0750a7b /sys/sys/pcpu.h
parentc38eeb8eb0d5318ce502bd75af4e9e719270022c (diff)
downloadsrc-16147166550303ef4e55db8ebea57df6e7caeba7.tar.gz
src-16147166550303ef4e55db8ebea57df6e7caeba7.zip
Save a call to pmap_remove() if entry cannot have any pages mapped.
Due to the way rtld creates mappings for the shared objects, each dso causes unmap of at least three guard map entries. For instance, in the buildworld load, this change reduces the amount of pmap_remove() calls by 1/5. Profiled by: alc Reviewed by: alc, markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D16148
Notes
Notes: svn path=/head/; revision=336045
Diffstat (limited to 'sys/sys/pcpu.h')
-rw-r--r--sys/sys/pcpu.h21
1 files changed, 13 insertions, 8 deletions
diff --git a/sys/sys/pcpu.h b/sys/sys/pcpu.h
index 9ba2adfdbff8..cba9d6e89797 100644
--- a/sys/sys/pcpu.h
+++ b/sys/sys/pcpu.h
@@ -185,14 +185,6 @@ struct pcpu {
PCPU_MD_FIELDS;
} __aligned(CACHE_LINE_SIZE);
-#ifdef CTASSERT
-/*
- * To minimize memory waste in per-cpu UMA zones, size of struct pcpu
- * should be denominator of PAGE_SIZE.
- */
-CTASSERT((PAGE_SIZE / sizeof(struct pcpu)) * sizeof(struct pcpu) == PAGE_SIZE);
-#endif
-
#ifdef _KERNEL
STAILQ_HEAD(cpuhead, pcpu);
@@ -209,6 +201,19 @@ extern struct pcpu *cpuid_to_pcpu[];
#define UMA_PCPU_ALLOC_SIZE PAGE_SIZE
+#ifdef CTASSERT
+#if defined(__i386__) || defined(__amd64__)
+/* Required for counters(9) to work on x86. */
+CTASSERT(sizeof(struct pcpu) == UMA_PCPU_ALLOC_SIZE);
+#else
+/*
+ * To minimize memory waste in per-cpu UMA zones, size of struct pcpu
+ * should be denominator of PAGE_SIZE.
+ */
+CTASSERT((PAGE_SIZE / sizeof(struct pcpu)) * sizeof(struct pcpu) == PAGE_SIZE);
+#endif /* UMA_PCPU_ALLOC_SIZE && x86 */
+#endif /* CTASSERT */
+
/* Accessor to elements allocated via UMA_ZONE_PCPU zone. */
static inline void *
zpcpu_get(void *base)