summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2015-03-06 13:58:45 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2015-03-06 14:58:13 +0100
commite5db084cd8a9dbbb9b11582686012a294535bba9 (patch)
tree3f6fc284f250712a05fd704fabc2b267874c80e1
parentrtems_bsd_mutex: SMP support via ISR locks (diff)
downloadrtems-libbsd-e5db084cd8a9dbbb9b11582686012a294535bba9.tar.bz2
ZONE(9): Enable per-processor cache for SMP
This prevents a potential deadlock via the Giant lock and is a performance benefit.
-rw-r--r--freebsd/sys/sys/systm.h4
-rw-r--r--freebsd/sys/vm/uma_core.c12
2 files changed, 14 insertions, 2 deletions
diff --git a/freebsd/sys/sys/systm.h b/freebsd/sys/sys/systm.h
index 18ca646f..5f894cf6 100644
--- a/freebsd/sys/sys/systm.h
+++ b/freebsd/sys/sys/systm.h
@@ -209,13 +209,13 @@ void critical_exit(void);
static __inline void
critical_enter(void)
{
- _Thread_Disable_dispatch();
+ _Thread_Dispatch_disable();
}
static __inline void
critical_exit(void)
{
- _Thread_Enable_dispatch();
+ _Thread_Dispatch_enable(_Per_CPU_Get());
}
#endif /* __rtems__ */
void init_param1(void);
diff --git a/freebsd/sys/vm/uma_core.c b/freebsd/sys/vm/uma_core.c
index 8a88caaf..f2045d3f 100644
--- a/freebsd/sys/vm/uma_core.c
+++ b/freebsd/sys/vm/uma_core.c
@@ -89,6 +89,18 @@ __FBSDID("$FreeBSD$");
#include <vm/uma_dbg.h>
#include <ddb/ddb.h>
+#ifdef __rtems__
+ #ifdef RTEMS_SMP
+ /*
+ * It is essential that we have a per-processor cache, otherwise the
+ * critical_enter()/critical_exit() protection would be insufficient.
+ */
+ #undef curcpu
+ #define curcpu rtems_get_current_processor()
+ #undef mp_maxid
+ #define mp_maxid rtems_get_processor_count()
+ #endif
+#endif /* __rtems__ */
/*
* This is the zone and keg from which all zones are spawned. The idea is that