aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorDavid Goldblatt <davidgoldblatt@fb.com>2017-09-29 13:54:08 -0700
committerDavid Goldblatt <davidtgoldblatt@gmail.com>2017-10-02 14:54:46 -0700
commit7a8bc7172b17e219b3603e99c8da44efb283e652 (patch)
tree3dbabc473cfe77fccb75cd69679a09974d1f747d /include
parent0720192a323f5dd2dd27828c6ab3061f8f039416 (diff)
downloadplatform_external_jemalloc_new-7a8bc7172b17e219b3603e99c8da44efb283e652.tar.gz
platform_external_jemalloc_new-7a8bc7172b17e219b3603e99c8da44efb283e652.tar.bz2
platform_external_jemalloc_new-7a8bc7172b17e219b3603e99c8da44efb283e652.zip
ARM: Don't extend bit LG_VADDR to compute high address bits.
In userspace ARM on Linux, zero-ing the high bits is the correct way to do this. This doesn't fix the fact that we currently set LG_VADDR to 48 on ARM, when in fact larger virtual address sizes are coming soon. We'll cross that bridge when we come to it.
Diffstat (limited to 'include')
-rw-r--r--include/jemalloc/internal/rtree.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/include/jemalloc/internal/rtree.h b/include/jemalloc/internal/rtree.h
index b5d4db39..4563db23 100644
--- a/include/jemalloc/internal/rtree.h
+++ b/include/jemalloc/internal/rtree.h
@@ -178,9 +178,21 @@ rtree_leaf_elm_bits_read(tsdn_t *tsdn, rtree_t *rtree, rtree_leaf_elm_t *elm,
JEMALLOC_ALWAYS_INLINE extent_t *
rtree_leaf_elm_bits_extent_get(uintptr_t bits) {
+# ifdef __aarch64__
+ /*
+ * aarch64 doesn't sign extend the highest virtual address bit to set
+ * the higher ones. Instead, the high bits gets zeroed.
+ */
+ uintptr_t high_bit_mask = ((uintptr_t)1 << LG_VADDR) - 1;
+ /* Mask off the slab bit. */
+ uintptr_t low_bit_mask = ~(uintptr_t)1;
+ uintptr_t mask = high_bit_mask & low_bit_mask;
+ return (extent_t *)(bits & mask);
+# else
/* Restore sign-extended high bits, mask slab bit. */
return (extent_t *)((uintptr_t)((intptr_t)(bits << RTREE_NHIB) >>
RTREE_NHIB) & ~((uintptr_t)0x1));
+# endif
}
JEMALLOC_ALWAYS_INLINE szind_t