Skip to content

Commit

Permalink
Fix ArenaTest.UnmappedAllocation for transparent huge pages
Browse files Browse the repository at this point in the history
Summary: ... by allocating in increments (1MiB) smaller than the
typical smallest huge page size of 2MiB.

Fixes facebook#12351

Test Plan:
```
sudo bash -c 'echo "always" > /sys/kernel/mm/transparent_hugepage/enabled'
```
And see unit test fails before this change, passes after this change
  • Loading branch information
pdillinger committed Feb 23, 2024
1 parent 2940aca commit 19f8ae6
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion memory/arena_test.cc
Expand Up @@ -267,7 +267,10 @@ TEST_F(ArenaTest, UnmappedAllocation) {
// Verify that it's possible to get unmapped pages in large allocations,
// for memory efficiency and to ensure we don't accidentally waste time &
// space initializing the memory.
constexpr size_t kBlockSize = 2U << 20;
//
// This block size value is smaller than the smallest x86 huge page size,
// so should not be fulfilled by a transparent huge page mapping.
constexpr size_t kBlockSize = 1U << 20;
Arena arena(kBlockSize);

// The allocator might give us back recycled memory for a while, but
Expand Down

0 comments on commit 19f8ae6

Please sign in to comment.