summaryrefslogtreecommitdiffstats
path: root/freebsd
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2019-02-12 08:29:55 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2019-02-12 08:57:42 +0100
commitb3bbfdfe91277d28ad72f44e87c48fc8173bbc09 (patch)
tree3e65b268cf92e442187c6551f51efc92669442de /freebsd
parentatomic.h: Add atomic_fetchadd_64() (diff)
downloadrtems-libbsd-b3bbfdfe91277d28ad72f44e87c48fc8173bbc09.tar.bz2
ZONE(9): Fix UMA_PCPU_ALLOC_SIZE
Using CACHE_LINE_SIZE for UMA_PCPU_ALLOC_SIZE was a huge memory waste since the backend memory allocator is page based.
Diffstat (limited to 'freebsd')
-rw-r--r--freebsd/sys/sys/pcpu.h10
1 files changed, 4 insertions, 6 deletions
diff --git a/freebsd/sys/sys/pcpu.h b/freebsd/sys/sys/pcpu.h
index 7aad9f2e..de5936f6 100644
--- a/freebsd/sys/sys/pcpu.h
+++ b/freebsd/sys/sys/pcpu.h
@@ -170,6 +170,7 @@ extern uintptr_t dpcpu_off[];
#endif /* _KERNEL */
+#ifndef __rtems__
/*
* This structure maps out the global data that needs to be kept on a
* per-cpu basis. The members are accessed via the PCPU_GET/SET/PTR
@@ -177,7 +178,6 @@ extern uintptr_t dpcpu_off[];
* defined in the PCPU_MD_FIELDS macro defined in <machine/pcpu.h>.
*/
struct pcpu {
-#ifndef __rtems__
struct thread *pc_curthread; /* Current thread */
struct thread *pc_idlethread; /* Idle thread */
struct thread *pc_fpcurthread; /* Fp state owner */
@@ -208,10 +208,10 @@ struct pcpu {
* if only to make kernel debugging easier.
*/
PCPU_MD_FIELDS;
+} __aligned(CACHE_LINE_SIZE);
#else /* __rtems__ */
- int pc_dummy;
+struct pcpu;
#endif /* __rtems__ */
-} __aligned(CACHE_LINE_SIZE);
#ifdef _KERNEL
@@ -227,9 +227,9 @@ extern struct pcpu *cpuid_to_pcpu[];
#endif
#define curvidata PCPU_GET(vidata)
-#ifndef __rtems__
#define UMA_PCPU_ALLOC_SIZE PAGE_SIZE
+#ifndef __rtems__
#ifdef CTASSERT
#if defined(__i386__) || defined(__amd64__)
/* Required for counters(9) to work on x86. */
@@ -242,8 +242,6 @@ CTASSERT(sizeof(struct pcpu) == UMA_PCPU_ALLOC_SIZE);
CTASSERT((PAGE_SIZE / sizeof(struct pcpu)) * sizeof(struct pcpu) == PAGE_SIZE);
#endif /* UMA_PCPU_ALLOC_SIZE && x86 */
#endif /* CTASSERT */
-#else /* __rtems__ */
-#define UMA_PCPU_ALLOC_SIZE sizeof(struct pcpu)
#endif /* __rtems__ */
/* Accessor to elements allocated via UMA_ZONE_PCPU zone. */