[PATCH] D86800: [scudo][standalone] Enable secondary cache release on Fuchsia
Kostya Kortchinsky via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 2 11:37:47 PDT 2020
cryptoad updated this revision to Diff 289522.
cryptoad added a comment.
Herald added a subscriber: phosek.
I was wrong about the base paramater to use with `releasePagesToOS` on Fuchsia,
it's the base of the committed mapping, which is not the base of the reserved
mapping. So change that back to what it was.
Also fix 2 issues for tests to work on Fuchsia: include `<set>` and mark a static
variable as possibly unused since Fuchsia complains about it.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D86800/new/
https://reviews.llvm.org/D86800
Files:
compiler-rt/lib/scudo/standalone/secondary.h
compiler-rt/lib/scudo/standalone/tests/combined_test.cpp
compiler-rt/lib/scudo/standalone/tests/secondary_test.cpp
Index: compiler-rt/lib/scudo/standalone/tests/secondary_test.cpp
===================================================================
--- compiler-rt/lib/scudo/standalone/tests/secondary_test.cpp
+++ compiler-rt/lib/scudo/standalone/tests/secondary_test.cpp
@@ -56,18 +56,12 @@
TEST(ScudoSecondaryTest, SecondaryBasic) {
testSecondaryBasic<scudo::MapAllocator<scudo::MapAllocatorNoCache>>();
-#if !SCUDO_FUCHSIA
testSecondaryBasic<scudo::MapAllocator<scudo::MapAllocatorCache<>>>();
testSecondaryBasic<
scudo::MapAllocator<scudo::MapAllocatorCache<128U, 64U, 1UL << 20>>>();
-#endif
}
-#if SCUDO_FUCHSIA
-using LargeAllocator = scudo::MapAllocator<scudo::MapAllocatorNoCache>;
-#else
using LargeAllocator = scudo::MapAllocator<scudo::MapAllocatorCache<>>;
-#endif
// This exercises a variety of combinations of size and alignment for the
// MapAllocator. The size computation done here mimic the ones done by the
Index: compiler-rt/lib/scudo/standalone/tests/combined_test.cpp
===================================================================
--- compiler-rt/lib/scudo/standalone/tests/combined_test.cpp
+++ compiler-rt/lib/scudo/standalone/tests/combined_test.cpp
@@ -14,6 +14,7 @@
#include <condition_variable>
#include <memory>
#include <mutex>
+#include <set>
#include <thread>
#include <vector>
@@ -23,7 +24,8 @@
static constexpr scudo::Chunk::Origin Origin = scudo::Chunk::Origin::Malloc;
-static void disableDebuggerdMaybe() {
+// Fuchsia complains that the function is not used.
+UNUSED static void disableDebuggerdMaybe() {
#if SCUDO_ANDROID
// Disable the debuggerd signal handler on Android, without this we can end
// up spending a significant amount of time creating tombstones.
Index: compiler-rt/lib/scudo/standalone/secondary.h
===================================================================
--- compiler-rt/lib/scudo/standalone/secondary.h
+++ compiler-rt/lib/scudo/standalone/secondary.h
@@ -75,11 +75,6 @@
s32 MaxReleaseToOsIntervalMs = INT32_MAX>
class MapAllocatorCache {
public:
- // Fuchsia doesn't allow releasing Secondary blocks yet. Note that 0 length
- // arrays are an extension for some compilers.
- // FIXME(kostyak): support (partially) the cache on Fuchsia.
- static_assert(!SCUDO_FUCHSIA || EntriesArraySize == 0U, "");
-
// Ensure the default maximum specified fits the array.
static_assert(DefaultMaxEntriesCount <= EntriesArraySize, "");
@@ -392,9 +387,9 @@
}
const uptr CommitSize = MapEnd - PageSize - CommitBase;
- const uptr Ptr =
- reinterpret_cast<uptr>(map(reinterpret_cast<void *>(CommitBase),
- CommitSize, "scudo:secondary", 0, &Data));
+ const uptr Ptr = reinterpret_cast<uptr>(
+ map(reinterpret_cast<void *>(CommitBase), CommitSize, "scudo:secondary",
+ MAP_RESIZABLE, &Data));
LargeBlock::Header *H = reinterpret_cast<LargeBlock::Header *>(Ptr);
H->MapBase = MapBase;
H->MapSize = MapEnd - MapBase;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D86800.289522.patch
Type: text/x-patch
Size: 2996 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200902/4c31c9b3/attachment.bin>
More information about the llvm-commits
mailing list