|
|
266176 |
From 8cfc9dec37b312a2686f602bbcdd102ca07cca99 Mon Sep 17 00:00:00 2001
|
|
|
266176 |
From: David Goldblatt <davidgoldblatt@fb.com>
|
|
|
266176 |
Date: Fri, 29 Sep 2017 13:54:08 -0700
|
|
|
266176 |
Subject: [PATCH] ARM: Don't extend bit LG_VADDR to compute high address bits.
|
|
|
266176 |
|
|
|
266176 |
In userspace ARM on Linux, zero-ing the high bits is the correct way to do this.
|
|
|
266176 |
This doesn't fix the fact that we currently set LG_VADDR to 48 on ARM, when in
|
|
|
266176 |
fact larger virtual address sizes are coming soon. We'll cross that bridge when
|
|
|
266176 |
we come to it.
|
|
|
266176 |
---
|
|
|
266176 |
include/jemalloc/internal/rtree.h | 12 ++++++++++++
|
|
|
266176 |
1 file changed, 12 insertions(+)
|
|
|
266176 |
|
|
|
266176 |
diff --git a/include/jemalloc/internal/rtree.h b/include/jemalloc/internal/rtree.h
|
|
|
266176 |
index b5d4db39..4563db23 100644
|
|
|
266176 |
--- a/include/jemalloc/internal/rtree.h
|
|
|
266176 |
+++ b/include/jemalloc/internal/rtree.h
|
|
|
266176 |
@@ -178,9 +178,21 @@ rtree_leaf_elm_bits_read(tsdn_t *tsdn, rtree_t *rtree, rtree_leaf_elm_t *elm,
|
|
|
266176 |
|
|
|
266176 |
JEMALLOC_ALWAYS_INLINE extent_t *
|
|
|
266176 |
rtree_leaf_elm_bits_extent_get(uintptr_t bits) {
|
|
|
266176 |
+# ifdef __aarch64__
|
|
|
266176 |
+ /*
|
|
|
266176 |
+ * aarch64 doesn't sign extend the highest virtual address bit to set
|
|
|
266176 |
+ * the higher ones. Instead, the high bits gets zeroed.
|
|
|
266176 |
+ */
|
|
|
266176 |
+ uintptr_t high_bit_mask = ((uintptr_t)1 << LG_VADDR) - 1;
|
|
|
266176 |
+ /* Mask off the slab bit. */
|
|
|
266176 |
+ uintptr_t low_bit_mask = ~(uintptr_t)1;
|
|
|
266176 |
+ uintptr_t mask = high_bit_mask & low_bit_mask;
|
|
|
266176 |
+ return (extent_t *)(bits & mask);
|
|
|
266176 |
+# else
|
|
|
266176 |
/* Restore sign-extended high bits, mask slab bit. */
|
|
|
266176 |
return (extent_t *)((uintptr_t)((intptr_t)(bits << RTREE_NHIB) >>
|
|
|
266176 |
RTREE_NHIB) & ~((uintptr_t)0x1));
|
|
|
266176 |
+# endif
|
|
|
266176 |
}
|
|
|
266176 |
|
|
|
266176 |
JEMALLOC_ALWAYS_INLINE szind_t
|