From 1e64e36135dde99d23760b1370e8ceb70a8d683c Mon Sep 17 00:00:00 2001 From: Stefan Johansson Date: Wed, 25 Sep 2024 16:00:06 +0200 Subject: [PATCH] Move statistics to cover all cases --- src/hotspot/share/gc/z/zPageAllocator.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/hotspot/share/gc/z/zPageAllocator.cpp b/src/hotspot/share/gc/z/zPageAllocator.cpp index 7a884df71ddb2..e0f5f2ac1335b 100644 --- a/src/hotspot/share/gc/z/zPageAllocator.cpp +++ b/src/hotspot/share/gc/z/zPageAllocator.cpp @@ -488,6 +488,9 @@ ZPage* ZPageAllocator::defragment_page(ZPage* page) { ZPage* new_page = new ZPage(ZPageType::small, vmem, pmem); map_page(new_page); + // Update statistics + ZStatInc(ZCounterDefragment); + return new_page; } @@ -834,7 +837,6 @@ void ZPageAllocator::free_pages(const ZArray* pages) { // Check if page needs to be remapped to avoid fragmentation if (should_defragment(page)) { - ZStatInc(ZCounterDefragment); to_recycle.push(defragment_page(_safe_recycle.register_and_clone_if_activated(page))); } else { to_recycle.push(_safe_recycle.register_and_clone_if_activated(page));