From c01a885e94b6edb8545113d3ba43248b4b75e90c Mon Sep 17 00:00:00 2001 From: Alex Lapenkou Date: Thu, 19 Aug 2021 15:16:11 -0700 Subject: [PATCH] HPA: Correctly calculate retained pages Retained pages are those which haven't been touched and are unbacked from OS perspective. For a pageslab their number should equal "total pages in slab" minus "touched pages". --- include/jemalloc/internal/hpdata.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/jemalloc/internal/hpdata.h b/include/jemalloc/internal/hpdata.h index c2ed692b..1fb534db 100644 --- a/include/jemalloc/internal/hpdata.h +++ b/include/jemalloc/internal/hpdata.h @@ -292,7 +292,7 @@ hpdata_ndirty_get(hpdata_t *hpdata) { static inline size_t hpdata_nretained_get(hpdata_t *hpdata) { - return hpdata->h_nactive - hpdata->h_ntouched; + return HUGEPAGE_PAGES - hpdata->h_ntouched; } static inline void