Skip to content

Commit ad3ad2c

Browse files
committed
[libpas] Hold small-seg pages longer before decommit
https://bugs.webkit.org/show_bug.cgi?id=328277 rdar://problem/190568833 Reviewed by Yusuke Suzuki and Mark Lam. This patch gives segregated directories for small segregated pages an additional epoch-offset, allowing their physical memory to survive longer after it becomes free. This epoch-offset is 900ms on Mac (bringing the total epoch deadline to 1.5s) and 450ms on other platforms (bringing the total to 750ms). The offset was chosen empirically, and is expected to yield around an 0.5% SP3 improvement on recent macOS platforms, without a significant memory cost. Increasing the epoch for all pages to the same number gives a similiar degree of performance uplift, but at a significant memory cost (>4% on some benchmarks), suggesting that there is not much upside to increasing the epoch-offset for non-small-segregated pages at this time. Above ~1s, further increasing the epoch-offset, even for small-segregated pages, does not give significant performance increases, but does begin to hurt memory usage as as cold pages are retained for increasingly long periods of time. * Source/bmalloc/libpas/src/libpas/pas_page_sharing_participant.c: add 900ms delay on macOS * Source/bmalloc/libpas/src/test/TestHarness.cpp: (EpochIsCounter::EpochIsCounter): override epochs before running test Canonical link: https://commits.webkit.org/324728@main
1 parent 37e9021 commit ad3ad2c

2 files changed

Lines changed: 14 additions & 1 deletion

File tree

‎Source/bmalloc/libpas/src/libpas/pas_page_sharing_participant.c‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,14 @@
3838
#include "pas_segregated_page_config_kind.h"
3939
#include "pas_segregated_size_directory.h"
4040

41-
uint64_t pas_segregated_participant_epoch_offsets[PAS_NUM_SEGREGATED_PAGE_CONFIG_VARIANTS];
41+
uint64_t pas_segregated_participant_epoch_offsets[PAS_NUM_SEGREGATED_PAGE_CONFIG_VARIANTS] = {
42+
/* Small segregated pages are especially sensitive to decommit */
43+
#if PAS_PLATFORM(MAC)
44+
[pas_small_segregated_page_config_variant] = 900ull * 1000ull * 1000ull,
45+
#else
46+
[pas_small_segregated_page_config_variant] = 450ull * 1000ull * 1000ull,
47+
#endif
48+
};
4249
uint64_t pas_bitfit_participant_epoch_offsets[PAS_NUM_BITFIT_PAGE_CONFIG_VARIANTS];
4350
uint64_t pas_page_sharing_participant_large_sharing_pool_epoch_offset;
4451

‎Source/bmalloc/libpas/src/test/TestHarness.cpp‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
#include "minalign32_heap_config.h"
3737
#include "pagesize64k_heap_config.h"
3838
#include "pas_epoch.h"
39+
#include "pas_page_sharing_participant.h"
3940
#include "pas_fd_stream.h"
4041
#include "pas_heap.h"
4142
#include "pas_mte_config.h"
@@ -222,6 +223,11 @@ EpochIsCounter::EpochIsCounter()
222223
[] () {
223224
pas_epoch_is_counter = true;
224225
pas_scavenger_max_epoch_delta = 0;
226+
/* The epoch is just a counter here, so the time-based retention offsets are meaningless
227+
(and would keep pages from ever expiring). */
228+
memset(pas_segregated_participant_epoch_offsets, 0, sizeof(pas_segregated_participant_epoch_offsets));
229+
memset(pas_bitfit_participant_epoch_offsets, 0, sizeof(pas_bitfit_participant_epoch_offsets));
230+
pas_page_sharing_participant_large_sharing_pool_epoch_offset = 0;
225231
})
226232
{
227233
}

0 commit comments

Comments
 (0)