diff options
| author | David Goldblatt <davidgoldblatt@fb.com> | 2017-10-03 18:03:02 -0700 |
|---|---|---|
| committer | David Goldblatt <davidtgoldblatt@gmail.com> | 2017-10-04 18:37:23 -0700 |
| commit | 1245faae9052350a96dbcb22de7979bca566dbec (patch) | |
| tree | 19043580b26ec4953bab4435e44206d71e7db697 /include | |
| parent | 7c6c99b8295829580c506067495a23c07436e266 (diff) | |
| download | platform_external_jemalloc_new-1245faae9052350a96dbcb22de7979bca566dbec.tar.gz platform_external_jemalloc_new-1245faae9052350a96dbcb22de7979bca566dbec.tar.bz2 platform_external_jemalloc_new-1245faae9052350a96dbcb22de7979bca566dbec.zip | |
Power: disable the CPU_SPINWAIT macro.
Quoting from https://github.com/jemalloc/jemalloc/issues/761 :
[...] reading the Power ISA documentation[1], the assembly in [the CPU_SPINWAIT
macro] isn't correct anyway (as @marxin points out): the setting of the
program-priority register is "sticky", and we never undo the lowering.
We could do something similar, but given that we don't have testing here in the
first place, I'm inclined to simply not try. I'll put something up reverting the
problematic commit tomorrow.
[1] Book II, chapter 3 of the 2.07B or 3.0B ISA documents.
Diffstat (limited to 'include')
| -rw-r--r-- | include/jemalloc/internal/jemalloc_internal_defs.h.in | 2 | ||||
| -rw-r--r-- | include/jemalloc/internal/spin.h | 12 |
2 files changed, 13 insertions, 1 deletions
diff --git a/include/jemalloc/internal/jemalloc_internal_defs.h.in b/include/jemalloc/internal/jemalloc_internal_defs.h.in index 5fa7f51f..31262fb2 100644 --- a/include/jemalloc/internal/jemalloc_internal_defs.h.in +++ b/include/jemalloc/internal/jemalloc_internal_defs.h.in @@ -33,6 +33,8 @@ * order to yield to another virtual CPU. */ #undef CPU_SPINWAIT +/* 1 if CPU_SPINWAIT is defined, 0 otherwise. */ +#undef HAVE_CPU_SPINWAIT /* * Number of significant bits in virtual addresses. This may be less than the diff --git a/include/jemalloc/internal/spin.h b/include/jemalloc/internal/spin.h index aded0fcc..22804c68 100644 --- a/include/jemalloc/internal/spin.h +++ b/include/jemalloc/internal/spin.h @@ -8,12 +8,22 @@ typedef struct { } spin_t; static inline void +spin_cpu_spinwait() { +# if HAVE_CPU_SPINWAIT + CPU_SPINWAIT; +# else + volatile int x = 0; + x = x; +# endif +} + +static inline void spin_adaptive(spin_t *spin) { volatile uint32_t i; if (spin->iteration < 5) { for (i = 0; i < (1U << spin->iteration); i++) { - CPU_SPINWAIT; + spin_cpu_spinwait(); } spin->iteration++; } else { |
