From tpushkin at openjdk.org Tue Jul 1 07:23:55 2025 From: tpushkin at openjdk.org (Timofei Pushkin) Date: Tue, 1 Jul 2025 07:23:55 GMT Subject: [crac] RFR: 8361124: [CRaC] Move recursive checkpoint test to simengine Message-ID: At the moment of creation this PR includes #239 ? that should be merged first. fc33e85c429536dcc89ff59afed6450bb7562639 is the change of this PR. Makes recursive checkpoint test use `simengine` instead of `pauseengine`. Since that was the only test using `pauseengine`, a separate `PauseEngineTest` is created to test the engine. ------------- Commit messages: - Fix recursive checkpoint test - Make dev engines less confusing Changes: https://git.openjdk.org/crac/pull/240/files Webrev: https://webrevs.openjdk.org/?repo=crac&pr=240&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8361124 Stats: 583 lines in 9 files changed: 312 ins; 266 del; 5 mod Patch: https://git.openjdk.org/crac/pull/240.diff Fetch: git fetch https://git.openjdk.org/crac.git pull/240/head:pull/240 PR: https://git.openjdk.org/crac/pull/240 From rvansa at openjdk.org Tue Jul 1 09:00:54 2025 From: rvansa at openjdk.org (Radim Vansa) Date: Tue, 1 Jul 2025 09:00:54 GMT Subject: [crac] RFR: 8361090: [CRaC] Make dev engines less confusing In-Reply-To: References: Message-ID: On Mon, 30 Jun 2025 17:21:50 GMT, Timofei Pushkin wrote: > - Makes `pauseengine` Linux-only since it is not fully implemented on MacOS and Windows > - Also moves `criuengine` sources from `unix` to `linux` directory since it only supports Linux anyway > - Makes `simengine` and `pausengine` report errors and status in more details src/java.base/linux/native/pauseengine/pauseengine.c line 68: > 66: fclose(pidfile); > 67: > 68: printf(PAUSEENGINE "pausing the process, restore in another process to unpause it\n"); I would rather see all these logging messages going into `stderr`. ------------- PR Review Comment: https://git.openjdk.org/crac/pull/239#discussion_r2176883220 From rvansa at openjdk.org Tue Jul 1 09:26:11 2025 From: rvansa at openjdk.org (Radim Vansa) Date: Tue, 1 Jul 2025 09:26:11 GMT Subject: [crac] RFR: 8361124: [CRaC] Move recursive checkpoint test to simengine In-Reply-To: References: Message-ID: On Tue, 1 Jul 2025 07:18:51 GMT, Timofei Pushkin wrote: > At the moment of creation this PR includes #239 ? that should be merged first. fc33e85c429536dcc89ff59afed6450bb7562639 is the change of this PR. > > Makes recursive checkpoint test use `simengine` instead of `pauseengine`. Since that was the only test using `pauseengine`, a separate `PauseEngineTest` is created to test the engine. I don't really like `RecursiveCheckpointTest.exception` being not synchronized at all; could you turn this into a concurrent collection? ------------- PR Review: https://git.openjdk.org/crac/pull/240#pullrequestreview-2974464402 From tpushkin at openjdk.org Tue Jul 1 10:27:51 2025 From: tpushkin at openjdk.org (Timofei Pushkin) Date: Tue, 1 Jul 2025 10:27:51 GMT Subject: [crac] RFR: 8361090: [CRaC] Make dev engines less confusing In-Reply-To: References: Message-ID: On Tue, 1 Jul 2025 08:49:29 GMT, Radim Vansa wrote: >> - Makes `pauseengine` Linux-only since it is not fully implemented on MacOS and Windows >> - Also moves `criuengine` sources from `unix` to `linux` directory since it only supports Linux anyway >> - Makes `simengine` and `pausengine` report errors and status in more details > > src/java.base/linux/native/pauseengine/pauseengine.c line 68: > >> 66: fclose(pidfile); >> 67: >> 68: printf(PAUSEENGINE "pausing the process, restore in another process to unpause it\n"); > > I would rather see all these logging messages going into `stderr`. Warp prints its "Checkpoint successful" message to stout IIRC, then this should.go there too since it is essentially the same thing. We can make it disable-able via `-XX:CRaCEngineOptions=args=-quiet` for example. ------------- PR Review Comment: https://git.openjdk.org/crac/pull/239#discussion_r2177144915 From tpushkin at openjdk.org Tue Jul 1 12:47:01 2025 From: tpushkin at openjdk.org (Timofei Pushkin) Date: Tue, 1 Jul 2025 12:47:01 GMT Subject: [crac] RFR: 8361090: [CRaC] Make dev engines less confusing In-Reply-To: References: Message-ID: <0QGjBVl-AbJa2rD-Xn5Uul0m1Pt7KtS1I_KFa-RaH8k=.42c3ed3e-3e7b-4b92-8814-dab71a05e849@github.com> On Tue, 1 Jul 2025 10:24:59 GMT, Timofei Pushkin wrote: >> src/java.base/linux/native/pauseengine/pauseengine.c line 68: >> >>> 66: fclose(pidfile); >>> 67: >>> 68: printf(PAUSEENGINE "pausing the process, restore in another process to unpause it\n"); >> >> I would rather see all these logging messages going into `stderr`. > > Warp prints its "Checkpoint successful" message to stout IIRC, then this should.go there too since it is essentially the same thing. We can make it disable-able via `-XX:CRaCEngineOptions=args=-quiet` for example. NVMD, Warp actually prints to stderr, I was mistaken ------------- PR Review Comment: https://git.openjdk.org/crac/pull/239#discussion_r2177512940 From tpushkin at openjdk.org Tue Jul 1 12:56:56 2025 From: tpushkin at openjdk.org (Timofei Pushkin) Date: Tue, 1 Jul 2025 12:56:56 GMT Subject: [crac] RFR: 8361090: [CRaC] Make dev engines less confusing [v2] In-Reply-To: References: Message-ID: > - Makes `pauseengine` Linux-only since it is not fully implemented on MacOS and Windows > - Also moves `criuengine` sources from `unix` to `linux` directory since it only supports Linux anyway > - Makes `simengine` and `pausengine` report errors and status in more details Timofei Pushkin has updated the pull request incrementally with one additional commit since the last revision: Log to stderr ------------- Changes: - all: https://git.openjdk.org/crac/pull/239/files - new: https://git.openjdk.org/crac/pull/239/files/e4d6832c..e87556e4 Webrevs: - full: https://webrevs.openjdk.org/?repo=crac&pr=239&range=01 - incr: https://webrevs.openjdk.org/?repo=crac&pr=239&range=00-01 Stats: 2 lines in 1 file changed: 0 ins; 0 del; 2 mod Patch: https://git.openjdk.org/crac/pull/239.diff Fetch: git fetch https://git.openjdk.org/crac.git pull/239/head:pull/239 PR: https://git.openjdk.org/crac/pull/239 From tpushkin at openjdk.org Tue Jul 1 15:18:45 2025 From: tpushkin at openjdk.org (Timofei Pushkin) Date: Tue, 1 Jul 2025 15:18:45 GMT Subject: [crac] RFR: 8361124: [CRaC] Move recursive checkpoint test to simengine [v2] In-Reply-To: References: Message-ID: > At the moment of creation this PR includes #239 ? that should be merged first. fc33e85c429536dcc89ff59afed6450bb7562639 is the change of this PR. > > Makes recursive checkpoint test use `simengine` instead of `pauseengine`. Since that was the only test using `pauseengine`, a separate `PauseEngineTest` is created to test the engine. Timofei Pushkin has updated the pull request incrementally with one additional commit since the last revision: Improve exception handling in recursive C/R test ------------- Changes: - all: https://git.openjdk.org/crac/pull/240/files - new: https://git.openjdk.org/crac/pull/240/files/fc33e85c..d616ee8f Webrevs: - full: https://webrevs.openjdk.org/?repo=crac&pr=240&range=01 - incr: https://webrevs.openjdk.org/?repo=crac&pr=240&range=00-01 Stats: 67 lines in 1 file changed: 17 ins; 31 del; 19 mod Patch: https://git.openjdk.org/crac/pull/240.diff Fetch: git fetch https://git.openjdk.org/crac.git pull/240/head:pull/240 PR: https://git.openjdk.org/crac/pull/240 From rvansa at openjdk.org Wed Jul 2 09:48:15 2025 From: rvansa at openjdk.org (Radim Vansa) Date: Wed, 2 Jul 2025 09:48:15 GMT Subject: [crac] RFR: 8361124: [CRaC] Move recursive checkpoint test to simengine [v2] In-Reply-To: References: Message-ID: On Tue, 1 Jul 2025 15:18:45 GMT, Timofei Pushkin wrote: >> At the moment of creation this PR includes #239 ? that should be merged first. fc33e85c429536dcc89ff59afed6450bb7562639 is the change of this PR. >> >> Makes recursive checkpoint test use `simengine` instead of `pauseengine`. Since that was the only test using `pauseengine`, a separate `PauseEngineTest` is created to test the engine. > > Timofei Pushkin has updated the pull request incrementally with one additional commit since the last revision: > > Improve exception handling in recursive C/R test LGTM, let's just integrate the other PR first. ------------- Marked as reviewed by rvansa (Committer). PR Review: https://git.openjdk.org/crac/pull/240#pullrequestreview-2978489806 From rvansa at openjdk.org Wed Jul 2 09:51:02 2025 From: rvansa at openjdk.org (Radim Vansa) Date: Wed, 2 Jul 2025 09:51:02 GMT Subject: [crac] RFR: 8361090: [CRaC] Make dev engines less confusing [v2] In-Reply-To: References: Message-ID: <5dnZ79l122dCx0f0mKF5vTHovoeD2JCdXmY4s3yb21w=.35d5db6e-b118-44fb-a675-7c1820cd3033@github.com> On Tue, 1 Jul 2025 12:56:56 GMT, Timofei Pushkin wrote: >> - Makes `pauseengine` Linux-only since it is not fully implemented on MacOS and Windows >> - Also moves `criuengine` sources from `unix` to `linux` directory since it only supports Linux anyway >> - Makes `simengine` and `pausengine` report errors and status in more details > > Timofei Pushkin has updated the pull request incrementally with one additional commit since the last revision: > > Log to stderr Marked as reviewed by rvansa (Committer). ------------- PR Review: https://git.openjdk.org/crac/pull/239#pullrequestreview-2978492569 From tpushkin at openjdk.org Wed Jul 2 09:51:03 2025 From: tpushkin at openjdk.org (Timofei Pushkin) Date: Wed, 2 Jul 2025 09:51:03 GMT Subject: [crac] Integrated: 8361090: [CRaC] Make dev engines less confusing In-Reply-To: References: Message-ID: On Mon, 30 Jun 2025 17:21:50 GMT, Timofei Pushkin wrote: > - Makes `pauseengine` Linux-only since it is not fully implemented on MacOS and Windows > - Also moves `criuengine` sources from `unix` to `linux` directory since it only supports Linux anyway > - Makes `simengine` and `pausengine` report errors and status in more details This pull request has now been integrated. Changeset: f1e3b49d Author: Timofei Pushkin URL: https://git.openjdk.org/crac/commit/f1e3b49d8fdb0cd4eda8631118081e70b13b4db5 Stats: 250 lines in 7 files changed: 120 ins; 125 del; 5 mod 8361090: [CRaC] Make dev engines less confusing Reviewed-by: rvansa ------------- PR: https://git.openjdk.org/crac/pull/239 From tpushkin at openjdk.org Wed Jul 2 09:57:13 2025 From: tpushkin at openjdk.org (Timofei Pushkin) Date: Wed, 2 Jul 2025 09:57:13 GMT Subject: [crac] RFR: 8361124: [CRaC] Move recursive checkpoint test to simengine [v3] In-Reply-To: References: Message-ID: > At the moment of creation this PR includes #239 ? that should be merged first. fc33e85c429536dcc89ff59afed6450bb7562639 is the change of this PR. > > Makes recursive checkpoint test use `simengine` instead of `pauseengine`. Since that was the only test using `pauseengine`, a separate `PauseEngineTest` is created to test the engine. Timofei Pushkin has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains four commits: - Merge remote-tracking branch 'openjdk-crac/crac' into recursive-cr - Improve exception handling in recursive C/R test - Fix recursive checkpoint test - Make dev engines less confusing ------------- Changes: https://git.openjdk.org/crac/pull/240/files Webrev: https://webrevs.openjdk.org/?repo=crac&pr=240&range=02 Stats: 321 lines in 3 files changed: 179 ins; 142 del; 0 mod Patch: https://git.openjdk.org/crac/pull/240.diff Fetch: git fetch https://git.openjdk.org/crac.git pull/240/head:pull/240 PR: https://git.openjdk.org/crac/pull/240 From rvansa at openjdk.org Wed Jul 2 09:57:13 2025 From: rvansa at openjdk.org (Radim Vansa) Date: Wed, 2 Jul 2025 09:57:13 GMT Subject: [crac] RFR: 8361124: [CRaC] Move recursive checkpoint test to simengine [v3] In-Reply-To: References: Message-ID: <7ruy77-nvaiza_voQVZK6raKJAxHnSAIzBUSLc4MEGE=.11a50ba9-2fa5-43f5-9040-4a92aac04686@github.com> On Wed, 2 Jul 2025 09:54:15 GMT, Timofei Pushkin wrote: >> At the moment of creation this PR includes #239 ? that should be merged first. fc33e85c429536dcc89ff59afed6450bb7562639 is the change of this PR. >> >> Makes recursive checkpoint test use `simengine` instead of `pauseengine`. Since that was the only test using `pauseengine`, a separate `PauseEngineTest` is created to test the engine. > > Timofei Pushkin has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains four commits: > > - Merge remote-tracking branch 'openjdk-crac/crac' into recursive-cr > - Improve exception handling in recursive C/R test > - Fix recursive checkpoint test > - Make dev engines less confusing Marked as reviewed by rvansa (Committer). ------------- PR Review: https://git.openjdk.org/crac/pull/240#pullrequestreview-2978513034 From tpushkin at openjdk.org Wed Jul 2 12:26:14 2025 From: tpushkin at openjdk.org (Timofei Pushkin) Date: Wed, 2 Jul 2025 12:26:14 GMT Subject: [crac] Integrated: 8361124: [CRaC] Move recursive checkpoint test to simengine In-Reply-To: References: Message-ID: On Tue, 1 Jul 2025 07:18:51 GMT, Timofei Pushkin wrote: > At the moment of creation this PR includes #239 ? that should be merged first. fc33e85c429536dcc89ff59afed6450bb7562639 is the change of this PR. > > Makes recursive checkpoint test use `simengine` instead of `pauseengine`. Since that was the only test using `pauseengine`, a separate `PauseEngineTest` is created to test the engine. This pull request has now been integrated. Changeset: 74dabd26 Author: Timofei Pushkin URL: https://git.openjdk.org/crac/commit/74dabd26c7975657f8dc0b35687cfef637a634e2 Stats: 321 lines in 3 files changed: 179 ins; 142 del; 0 mod 8361124: [CRaC] Move recursive checkpoint test to simengine Reviewed-by: rvansa ------------- PR: https://git.openjdk.org/crac/pull/240 From dcherepanov at openjdk.org Fri Jul 11 17:42:52 2025 From: dcherepanov at openjdk.org (Dmitry Cherepanov) Date: Fri, 11 Jul 2025 17:42:52 GMT Subject: [crac] RFR: Merge jdk:jdk-25+19 Message-ID: After [JDK-8350441](https://bugs.openjdk.org/browse/JDK-8350441) removed Page Cache, the merge updates the original patch for [JDK-8353241](https://bugs.openjdk.org/browse/JDK-8353241) by moving some parts for uncommitting unused memory to Page Allocator. Comparing the test results for the original patch from https://github.com/openjdk/crac/pull/219 > the image is 177 MB with G1 while 215 MB with ZGC (fastdebug build, -Xmx1G) my testing shows 201 MB with G1 and 280 MB with ZGC (fastdebug build, -Xmx1G) I expect this part to be updated further after future merge with [JDK-8356716](https://bugs.openjdk.org/browse/JDK-8356716)
Conflicts commit 0b7dcb74717c57308db4f71dfca60dc3496cf566 (HEAD -> merge-jdk, dmitry-crac/merge-jdk) Merge: 74dabd26c79 a71f621a324 Author: Dmitry Cherepanov Date: Fri Jul 4 18:30:22 2025 +0400 Merge with jdk-25+19 diff --git a/src/hotspot/share/gc/z/zPageAllocator.cpp b/src/hotspot/share/gc/z/zPageAllocator.cpp remerge CONFLICT (content): Merge conflict in src/hotspot/share/gc/z/zPageAllocator.cpp index 813ce39fc74..fa37122cb82 100644 --- a/src/hotspot/share/gc/z/zPageAllocator.cpp +++ b/src/hotspot/share/gc/z/zPageAllocator.cpp @@ -740,7 +740,7 @@ bool ZPartition::claim_capacity(ZMemoryAllocation* allocation) { return true; } -size_t ZPartition::uncommit(uint64_t* timeout) { +size_t ZPartition::uncommit(uint64_t* timeout, uintx delay) { ZArray flushed_vmems; size_t flushed = 0; @@ -754,9 +754,9 @@ size_t ZPartition::uncommit(uint64_t* timeout) { const double time_since_last_commit = std::floor(now - _last_commit); const double time_since_last_uncommit = std::floor(now - _last_uncommit); - if (time_since_last_commit < double(ZUncommitDelay)) { + if (time_since_last_commit < double(delay)) { // We have committed within the delay, stop uncommitting. - *timeout = uint64_t(double(ZUncommitDelay) - time_since_last_commit); + *timeout = uint64_t(double(delay) - time_since_last_commit); return 0; } @@ -769,15 +769,15 @@ size_t ZPartition::uncommit(uint64_t* timeout) { if (limit == 0) { // This may occur if the current max capacity for this partition is 0 - // Set timeout to ZUncommitDelay - *timeout = ZUncommitDelay; + // Set timeout to delay + *timeout = delay; return 0; } - if (time_since_last_uncommit < double(ZUncommitDelay)) { + if (time_since_last_uncommit < double(delay)) { // We are in the uncommit phase const size_t num_uncommits_left = _to_uncommit / limit; - const double time_left = double(ZUncommitDelay) - time_since_last_uncommit; + const double time_left = double(delay) - time_since_last_uncommit; if (time_left < *timeout * num_uncommits_left) { // Running out of time, speed up. uint64_t new_timeout = uint64_t(std::floor(time_left / double(num_uncommits_left + 1))); @@ -789,7 +789,7 @@ size_t ZPartition::uncommit(uint64_t* timeout) { _last_uncommit = now; const size_t split = _to_uncommit / limit + 1; - uint64_t new_timeout = ZUncommitDelay / split; + uint64_t new_timeout = delay / split; *timeout = new_timeout; } @@ -2251,57 +2251,10 @@ void ZPageAllocator::decrease_used(size_t size) { // Update atomically since we have concurrent readers const size_t used = Atomic::sub(&_used, size); -<<<<<<< 74dabd26c79 (8361124: [CRaC] Move recursive checkpoint test to simengine) - // Only decrease the overall used and not the generation used, - // since the allocation failed and generation used wasn't bumped. - decrease_used(allocation->size()); - - size_t freed = 0; - - // Free any allocated/flushed pages - ZListRemoveIterator iter(allocation->pages()); - for (ZPage* page; iter.next(&page);) { - freed += page->size(); - recycle_page(page); - } - - // Adjust capacity and used to reflect the failed capacity increase - const size_t remaining = allocation->size() - freed; - decrease_capacity(remaining, true /* set_max_capacity */); - - // Try satisfy stalled allocations - satisfy_stalled(); -} - -size_t ZPageAllocator::uncommit(uint64_t* timeout, uintx delay) { - // We need to join the suspendible thread set while manipulating capacity and - // used, to make sure GC safepoints will have a consistent view. - ZList pages; - size_t flushed; - - { - SuspendibleThreadSetJoiner sts_joiner; - ZLocker locker(&_lock); - - // Never uncommit below min capacity. We flush out and uncommit chunks at - // a time (~0.8% of the max capacity, but at least one granule and at most - // 256M), in case demand for memory increases while we are uncommitting. - const size_t retain = MAX2(_used, _min_capacity); - const size_t release = _capacity - retain; - const size_t limit = MIN2(align_up(_current_max_capacity >> 7, ZGranuleSize), 256 * M); - const size_t flush = MIN2(release, limit); - - // Flush pages to uncommit - flushed = _cache.flush_for_uncommit(flush, &pages, timeout, delay); - if (flushed == 0) { - // Nothing flushed - return 0; -======= // Update used low for (auto& stats : _collection_stats) { if (used < stats._used_low) { stats._used_low = used; ->>>>>>> a71f621a324 (8353694: Resolved Class/Field/Method CP entries missing from AOT Configuration) } } } @@ -2518,10 +2471,14 @@ void ZPageAllocator::print_on_inner(outputStream* st) const { void ZPageAllocator::uncommit_unused_memory() { uint64_t timeout; size_t flushed, uncommitted = 0; - do { - flushed = uncommit(&timeout, 0); - uncommitted += flushed; - } while (flushed > 0); + ZPartitionIterator iter = partition_iterator(); + for (ZPartition* partition; iter.next(&partition);) { + partition->_cache.reset_min(); + do { + flushed = partition->uncommit(&timeout, 0); + uncommitted += flushed; + } while (flushed > 0); + } if (uncommitted > 0) { EventZUncommit event; log_info(gc, heap)("Uncommitted (cleanup): %zuM(%.0f%%)", diff --git a/src/hotspot/share/gc/z/zPageAllocator.hpp b/src/hotspot/share/gc/z/zPageAllocator.hpp remerge CONFLICT (content): Merge conflict in src/hotspot/share/gc/z/zPageAllocator.hpp index d8dcffe011f..4259f60406f 100644 --- a/src/hotspot/share/gc/z/zPageAllocator.hpp +++ b/src/hotspot/share/gc/z/zPageAllocator.hpp @@ -283,13 +283,11 @@ class ZPageAllocator { void threads_do(ThreadClosure* tc) const; -<<<<<<< 74dabd26c79 (8361124: [CRaC] Move recursive checkpoint test to simengine) - void uncommit_unused_memory(); -======= void print_on(outputStream* st) const; void print_extended_on_error(outputStream* st) const; void print_on_error(outputStream* st) const; ->>>>>>> a71f621a324 (8353694: Resolved Class/Field/Method CP entries missing from AOT Configuration) + + void uncommit_unused_memory(); }; class ZPageAllocatorStats { diff --git a/src/hotspot/share/gc/z/zPageCache.cpp b/src/hotspot/share/gc/z/zPageCache.cpp deleted file mode 100644 remerge CONFLICT (modify/delete): src/hotspot/share/gc/z/zPageCache.cpp deleted in a71f621a324 (8353694: Resolved Class/Field/Method CP entries missing from AOT Configuration) and modified in 74dabd26c79 (8361124: [CRaC] Move recursive checkpoint test to simengine). Version 74dabd26c79 (8361124: [CRaC] Move recursive checkpoint test to simengine) of src/hotspot/share/gc/z/zPageCache.cpp left in tree. index 4d35db5197b..00000000000 --- a/src/hotspot/share/gc/z/zPageCache.cpp +++ /dev/null @@ -1,334 +0,0 @@ -/* - * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -#include "gc/z/zGlobals.hpp" -#include "gc/z/zList.inline.hpp" -#include "gc/z/zNUMA.inline.hpp" -#include "gc/z/zPage.inline.hpp" -#include "gc/z/zPageCache.hpp" -#include "gc/z/zStat.hpp" -#include "gc/z/zValue.inline.hpp" -#include "memory/allocation.hpp" -#include "runtime/globals.hpp" -#include "runtime/os.hpp" - -static const ZStatCounter ZCounterPageCacheHitL1("Memory", "Page Cache Hit L1", ZStatUnitOpsPerSecond); -static const ZStatCounter ZCounterPageCacheHitL2("Memory", "Page Cache Hit L2", ZStatUnitOpsPerSecond); -static const ZStatCounter ZCounterPageCacheHitL3("Memory", "Page Cache Hit L3", ZStatUnitOpsPerSecond); -static const ZStatCounter ZCounterPageCacheMiss("Memory", "Page Cache Miss", ZStatUnitOpsPerSecond); - -class ZPageCacheFlushClosure : public StackObj { - friend class ZPageCache; - -protected: - const size_t _requested; - size_t _flushed; - -public: - ZPageCacheFlushClosure(size_t requested); - virtual bool do_page(const ZPage* page) = 0; -}; - -ZPageCacheFlushClosure::ZPageCacheFlushClosure(size_t requested) - : _requested(requested), - _flushed(0) {} - -ZPageCache::ZPageCache() - : _small(), - _medium(), - _large(), - _last_commit(0) {} - -ZPage* ZPageCache::alloc_small_page() { - const uint32_t numa_id = ZNUMA::id(); - const uint32_t numa_count = ZNUMA::count(); - - // Try NUMA local page cache - ZPage* const l1_page = _small.get(numa_id).remove_first(); - if (l1_page != nullptr) { - ZStatInc(ZCounterPageCacheHitL1); - return l1_page; - } - - // Try NUMA remote page cache(s) - uint32_t remote_numa_id = numa_id + 1; - const uint32_t remote_numa_count = numa_count - 1; - for (uint32_t i = 0; i < remote_numa_count; i++) { - if (remote_numa_id == numa_count) { - remote_numa_id = 0; - } - - ZPage* const l2_page = _small.get(remote_numa_id).remove_first(); - if (l2_page != nullptr) { - ZStatInc(ZCounterPageCacheHitL2); - return l2_page; - } - - remote_numa_id++; - } - - return nullptr; -} - -ZPage* ZPageCache::alloc_medium_page() { - ZPage* const page = _medium.remove_first(); - if (page != nullptr) { - ZStatInc(ZCounterPageCacheHitL1); - return page; - } - - return nullptr; -} - -ZPage* ZPageCache::alloc_large_page(size_t size) { - // Find a page with the right size - ZListIterator iter(&_large); - for (ZPage* page; iter.next(&page);) { - if (size == page->size()) { - // Page found - _large.remove(page); - ZStatInc(ZCounterPageCacheHitL1); - return page; - } - } - - return nullptr; -} - -ZPage* ZPageCache::alloc_oversized_medium_page(size_t size) { - if (size <= ZPageSizeMedium) { - return _medium.remove_first(); - } - - return nullptr; -} - -ZPage* ZPageCache::alloc_oversized_large_page(size_t size) { - // Find a page that is large enough - ZListIterator iter(&_large); - for (ZPage* page; iter.next(&page);) { - if (size <= page->size()) { - // Page found - _large.remove(page); - return page; - } - } - - return nullptr; -} - -ZPage* ZPageCache::alloc_oversized_page(size_t size) { - ZPage* page = alloc_oversized_large_page(size); - if (page == nullptr) { - page = alloc_oversized_medium_page(size); - } - - if (page != nullptr) { - ZStatInc(ZCounterPageCacheHitL3); - } - - return page; -} - -ZPage* ZPageCache::alloc_page(ZPageType type, size_t size) { - ZPage* page; - - // Try allocate exact page - if (type == ZPageType::small) { - page = alloc_small_page(); - } else if (type == ZPageType::medium) { - page = alloc_medium_page(); - } else { - page = alloc_large_page(size); - } - - if (page == nullptr) { - // Try allocate potentially oversized page - ZPage* const oversized = alloc_oversized_page(size); - if (oversized != nullptr) { - if (size < oversized->size()) { - // Split oversized page - page = oversized->split(type, size); - - // Cache remainder - free_page(oversized); - } else { - // Re-type correctly sized page - page = oversized->retype(type); - } - } - } - - if (page == nullptr) { - ZStatInc(ZCounterPageCacheMiss); - } - - return page; -} - -void ZPageCache::free_page(ZPage* page) { - const ZPageType type = page->type(); - if (type == ZPageType::small) { - _small.get(page->numa_id()).insert_first(page); - } else if (type == ZPageType::medium) { - _medium.insert_first(page); - } else { - _large.insert_first(page); - } -} - -bool ZPageCache::flush_list_inner(ZPageCacheFlushClosure* cl, ZList* from, ZList* to) { - ZPage* const page = from->last(); - if (page == nullptr || !cl->do_page(page)) { - // Don't flush page - return false; - } - - // Flush page - from->remove(page); - to->insert_last(page); - return true; -} - -void ZPageCache::flush_list(ZPageCacheFlushClosure* cl, ZList* from, ZList* to) { - while (flush_list_inner(cl, from, to)); -} - -void ZPageCache::flush_per_numa_lists(ZPageCacheFlushClosure* cl, ZPerNUMA >* from, ZList* to) { - const uint32_t numa_count = ZNUMA::count(); - uint32_t numa_done = 0; - uint32_t numa_next = 0; - - // Flush lists round-robin - while (numa_done < numa_count) { - ZList* const numa_list = from->addr(numa_next); - if (++numa_next == numa_count) { - numa_next = 0; - } - - if (flush_list_inner(cl, numa_list, to)) { - // Not done - numa_done = 0; - } else { - // Done - numa_done++; - } - } -} - -void ZPageCache::flush(ZPageCacheFlushClosure* cl, ZList* to) { - // Prefer flushing large, then medium and last small pages - flush_list(cl, &_large, to); - flush_list(cl, &_medium, to); - flush_per_numa_lists(cl, &_small, to); - - if (cl->_flushed > cl->_requested) { - // Overflushed, re-insert part of last page into the cache - const size_t overflushed = cl->_flushed - cl->_requested; - ZPage* const reinsert = to->last()->split(overflushed); - free_page(reinsert); - cl->_flushed -= overflushed; - } -} - -class ZPageCacheFlushForAllocationClosure : public ZPageCacheFlushClosure { -public: - ZPageCacheFlushForAllocationClosure(size_t requested) - : ZPageCacheFlushClosure(requested) {} - - virtual bool do_page(const ZPage* page) { - if (_flushed < _requested) { - // Flush page - _flushed += page->size(); - return true; - } - - // Don't flush page - return false; - } -}; - -void ZPageCache::flush_for_allocation(size_t requested, ZList* to) { - ZPageCacheFlushForAllocationClosure cl(requested); - flush(&cl, to); -} - -class ZPageCacheFlushForUncommitClosure : public ZPageCacheFlushClosure { -private: - const uint64_t _now; - uint64_t* _timeout; - uintx _delay; - -public: - ZPageCacheFlushForUncommitClosure(size_t requested, uint64_t now, uint64_t* timeout, uintx delay) - : ZPageCacheFlushClosure(requested), - _now(now), - _timeout(timeout), - _delay(delay) { - // Set initial timeout - *_timeout = delay; - } - - virtual bool do_page(const ZPage* page) { - const uint64_t expires = page->last_used() + _delay; - if (expires > _now) { - // Don't flush page, record shortest non-expired timeout - *_timeout = MIN2(*_timeout, expires - _now); - return false; - } - - if (_flushed >= _requested) { - // Don't flush page, requested amount flushed - return false; - } - - // Flush page - _flushed += page->size(); - return true; - } -}; - -size_t ZPageCache::flush_for_uncommit(size_t requested, ZList* to, uint64_t* timeout, uintx delay) { - const uint64_t now = (uint64_t)os::elapsedTime(); - const uint64_t expires = _last_commit + delay; - if (expires > now) { - // Delay uncommit, set next timeout - *timeout = expires - now; - return 0; - } - - if (requested == 0) { - // Nothing to flush, set next timeout - *timeout = delay; - return 0; - } - - ZPageCacheFlushForUncommitClosure cl(requested, now, timeout, delay); - flush(&cl, to); - - return cl._flushed; -} - -void ZPageCache::set_last_commit() { - _last_commit = (uint64_t)ceil(os::elapsedTime()); -} diff --git a/src/hotspot/share/gc/z/zPageCache.hpp b/src/hotspot/share/gc/z/zPageCache.hpp deleted file mode 100644 remerge CONFLICT (modify/delete): src/hotspot/share/gc/z/zPageCache.hpp deleted in a71f621a324 (8353694: Resolved Class/Field/Method CP entries missing from AOT Configuration) and modified in 74dabd26c79 (8361124: [CRaC] Move recursive checkpoint test to simengine). Version 74dabd26c79 (8361124: [CRaC] Move recursive checkpoint test to simengine) of src/hotspot/share/gc/z/zPageCache.hpp left in tree. index e36662e387d..00000000000 --- a/src/hotspot/share/gc/z/zPageCache.hpp +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (c) 2015, 2023, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -#ifndef SHARE_GC_Z_ZPAGECACHE_HPP -#define SHARE_GC_Z_ZPAGECACHE_HPP - -#include "gc/z/zList.hpp" -#include "gc/z/zPage.hpp" -#include "gc/z/zPageType.hpp" -#include "gc/z/zValue.hpp" - -class ZPageCacheFlushClosure; - -class ZPageCache { -private: - ZPerNUMA > _small; - ZList _medium; - ZList _large; - uint64_t _last_commit; - - ZPage* alloc_small_page(); - ZPage* alloc_medium_page(); - ZPage* alloc_large_page(size_t size); - - ZPage* alloc_oversized_medium_page(size_t size); - ZPage* alloc_oversized_large_page(size_t size); - ZPage* alloc_oversized_page(size_t size); - - bool flush_list_inner(ZPageCacheFlushClosure* cl, ZList* from, ZList* to); - void flush_list(ZPageCacheFlushClosure* cl, ZList* from, ZList* to); - void flush_per_numa_lists(ZPageCacheFlushClosure* cl, ZPerNUMA >* from, ZList* to); - void flush(ZPageCacheFlushClosure* cl, ZList* to); - -public: - ZPageCache(); - - ZPage* alloc_page(ZPageType type, size_t size); - void free_page(ZPage* page); - - void flush_for_allocation(size_t requested, ZList* to); - size_t flush_for_uncommit(size_t requested, ZList* to, uint64_t* timeout, uintx delay); - - void set_last_commit(); -}; - -#endif // SHARE_GC_Z_ZPAGECACHE_HPP diff --git a/src/hotspot/share/gc/z/zUncommitter.cpp b/src/hotspot/share/gc/z/zUncommitter.cpp remerge CONFLICT (content): Merge conflict in src/hotspot/share/gc/z/zUncommitter.cpp index 4505c95db1c..6ecbc6e6201 100644 --- a/src/hotspot/share/gc/z/zUncommitter.cpp +++ b/src/hotspot/share/gc/z/zUncommitter.cpp @@ -68,13 +68,8 @@ void ZUncommitter::run_thread() { while (should_continue()) { // Uncommit chunk -<<<<<<< 74dabd26c79 (8361124: [CRaC] Move recursive checkpoint test to simengine) - const size_t flushed = _page_allocator->uncommit(&timeout, ZUncommitDelay); - if (flushed == 0) { -======= - const size_t uncommitted = _partition->uncommit(&timeout); + const size_t uncommitted = _partition->uncommit(&timeout, ZUncommitDelay); if (uncommitted == 0) { ->>>>>>> a71f621a324 (8353694: Resolved Class/Field/Method CP entries missing from AOT Configuration) // Done break; } diff --git a/src/hotspot/share/logging/logAsyncWriter.cpp b/src/hotspot/share/logging/logAsyncWriter.cpp remerge CONFLICT (content): Merge conflict in src/hotspot/share/logging/logAsyncWriter.cpp index ff7c85b5c1d..dd82998a52e 100644 --- a/src/hotspot/share/logging/logAsyncWriter.cpp +++ b/src/hotspot/share/logging/logAsyncWriter.cpp @@ -358,7 +358,6 @@ void AsyncLogWriter::flush() { _instance->_flush_sem.wait(); } } -<<<<<<< 74dabd26c79 (8361124: [CRaC] Move recursive checkpoint test to simengine) void AsyncLogWriter::stop() { _block_async.lock(); @@ -368,29 +367,3 @@ void AsyncLogWriter::stop() { void AsyncLogWriter::resume() { _block_async.unlock(); } - -AsyncLogWriter::BufferUpdater::BufferUpdater(size_t newsize) { - ConsumerLocker clocker; - auto p = AsyncLogWriter::_instance; - - _buf1 = p->_buffer; - _buf2 = p->_buffer_staging; - p->_buffer = new Buffer(newsize); - p->_buffer_staging = new Buffer(newsize); -} - -AsyncLogWriter::BufferUpdater::~BufferUpdater() { - AsyncLogWriter::flush(); - auto p = AsyncLogWriter::_instance; - - { - ConsumerLocker clocker; - - delete p->_buffer; - delete p->_buffer_staging; - p->_buffer = _buf1; - p->_buffer_staging = _buf2; - } -} -======= ->>>>>>> a71f621a324 (8353694: Resolved Class/Field/Method CP entries missing from AOT Configuration) diff --git a/src/hotspot/share/runtime/threads.cpp b/src/hotspot/share/runtime/threads.cpp remerge CONFLICT (content): Merge conflict in src/hotspot/share/runtime/threads.cpp index 38550f61e48..4cfb43f6c01 100644 --- a/src/hotspot/share/runtime/threads.cpp +++ b/src/hotspot/share/runtime/threads.cpp @@ -426,7 +426,6 @@ void Threads::initialize_jsr292_core_classes(TRAPS) { } } -<<<<<<< 74dabd26c79 (8361124: [CRaC] Move recursive checkpoint test to simengine) static jint check_for_restore(JavaVMInitArgs* args) { if (Arguments::is_restore_option_set(args)) { if (!Arguments::parse_options_for_restore(args)) { @@ -435,7 +434,7 @@ static jint check_for_restore(JavaVMInitArgs* args) { } return JNI_OK; } -======= + // One-shot PeriodicTask subclass for reading the release file class ReadReleaseFileTask : public PeriodicTask { public: @@ -448,7 +447,6 @@ class ReadReleaseFileTask : public PeriodicTask { delete this; } }; ->>>>>>> a71f621a324 (8353694: Resolved Class/Field/Method CP entries missing from AOT Configuration) jint Threads::create_vm(JavaVMInitArgs* args, bool* canTryAgain) { extern void JDK_Version_init(); @@ -617,7 +615,6 @@ jint Threads::create_vm(JavaVMInitArgs* args, bool* canTryAgain) { return status; } -<<<<<<< 74dabd26c79 (8361124: [CRaC] Move recursive checkpoint test to simengine) // Output stream module should be already initialized for error reporting during restore. // JDK version should also be intialized. There is lot of initializations needed to read // the current machine's CPUFeatures. @@ -628,11 +625,10 @@ jint Threads::create_vm(JavaVMInitArgs* args, bool* canTryAgain) { return JNI_ERR; } } -======= + // Have the WatcherThread read the release file in the background. ReadReleaseFileTask* read_task = new ReadReleaseFileTask(); read_task->enroll(); ->>>>>>> a71f621a324 (8353694: Resolved Class/Field/Method CP entries missing from AOT Configuration) // Create WatcherThread as soon as we can since we need it in case // of hangs during error reporting.
------------- Commit messages: - Merge with jdk-25+19 - 8353694: Resolved Class/Field/Method CP entries missing from AOT Configuration - 8329887: RISC-V: C2: Support Zvbb Vector And-Not instruction - 8354559: gc/g1/TestAllocationFailure.java doesn't need WB API - 8295651: JFR: 'jfr scrub' should summarize what was removed - 8354471: Assertion failure with -XX:-EnableX86ECoreOpts - 8353589: Open source a few Swing menu-related tests - 8352001: AOT cache should not contain classes injected into built-in class loaders - 8354873: javax/swing/plaf/metal/MetalIconFactory/bug4952462.java failing on CI - 8351603: Change to GCC 14.2.0 for building on Linux at Oracle - ... and 108 more: https://git.openjdk.org/crac/compare/74dabd26...0b7dcb74 The webrevs contain the adjustments done while merging with regards to each parent branch: - crac: https://webrevs.openjdk.org/?repo=crac&pr=242&range=00.0 - jdk:jdk-25+19: https://webrevs.openjdk.org/?repo=crac&pr=242&range=00.1 Changes: https://git.openjdk.org/crac/pull/242/files Stats: 200018 lines in 645 files changed: 23990 ins; 173323 del; 2705 mod Patch: https://git.openjdk.org/crac/pull/242.diff Fetch: git fetch https://git.openjdk.org/crac.git pull/242/head:pull/242 PR: https://git.openjdk.org/crac/pull/242