aboutsummaryrefslogtreecommitdiff
path: root/sys/sys/pcpu.h
diff options
context:
space:
mode:
authorKonstantin Belousov <kib@FreeBSD.org>2018-07-06 19:50:44 +0000
committerKonstantin Belousov <kib@FreeBSD.org>2018-07-06 19:50:44 +0000
commit53dec71d39b769dbc0a49d229c551ce3fa10fee8 (patch)
tree63b869e2a6b87a9a927f5f29e590f918e0750a7b /sys/sys/pcpu.h
parentfb0a28119668e17c848af45a2b463f8d54101b0b (diff)
downloadsrc-53dec71d39b769dbc0a49d229c551ce3fa10fee8.tar.gz
src-53dec71d39b769dbc0a49d229c551ce3fa10fee8.zip
Expand x86 struct pcpus to UMA_PCPU_ALLOC_SIZE AKA PAGE_SIZE.
This restores counters(9) operation. Revert r336024. Improve assert of pcpu size on x86. Reviewed by: mmacy Sponsored by: The FreeBSD Foundation Differential revision: https://reviews.freebsd.org/D16163
Notes
Notes: svn path=/head/; revision=336047
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)