Re: RFR: 8343704: Bad GC parallelism with processing Cleaner queues [v17]

2024-12-04 Thread Aleksey Shipilev
On Tue, 3 Dec 2024 07:31:14 GMT, Aleksey Shipilev wrote: >> See the bug for more discussion and reproducer. This PR replaces the ad-hoc >> linked list with segmented list of arrays. Arrays are easy targets for GC. >> There are possible improvements here, most glaring is parallelism that is >>

Re: RFR: 8343704: Bad GC parallelism with processing Cleaner queues [v17]

2024-12-03 Thread Aleksey Shipilev
On Tue, 3 Dec 2024 07:31:14 GMT, Aleksey Shipilev wrote: >> See the bug for more discussion and reproducer. This PR replaces the ad-hoc >> linked list with segmented list of arrays. Arrays are easy targets for GC. >> There are possible improvements here, most glaring is parallelism that is >>

Re: RFR: 8343704: Bad GC parallelism with processing Cleaner queues [v17]

2024-12-02 Thread Aleksey Shipilev
> See the bug for more discussion and reproducer. This PR replaces the ad-hoc > linked list with segmented list of arrays. Arrays are easy targets for GC. > There are possible improvements here, most glaring is parallelism that is > currently knee-capped by global synchronization. The synchroniz

Re: RFR: 8343704: Bad GC parallelism with processing Cleaner queues [v16]

2024-12-02 Thread Viktor Klang
On Fri, 22 Nov 2024 17:33:35 GMT, Aleksey Shipilev wrote: >> See the bug for more discussion and reproducer. This PR replaces the ad-hoc >> linked list with segmented list of arrays. Arrays are easy targets for GC. >> There are possible improvements here, most glaring is parallelism that is >>

Re: RFR: 8343704: Bad GC parallelism with processing Cleaner queues [v14]

2024-12-02 Thread Brent Christian
On Wed, 27 Nov 2024 17:23:10 GMT, Aleksey Shipilev wrote: >> How about this: >> >>> ...the problem is in GC time hiccups to walk the large linked lists. >> >> Though, for this test, `CleanableList` itself is not being walked. >> >> Rather, `CleanableList` itself is a factor in as much as it ex

Re: RFR: 8343704: Bad GC parallelism with processing Cleaner queues [v16]

2024-12-02 Thread Brent Christian
On Fri, 22 Nov 2024 17:33:35 GMT, Aleksey Shipilev wrote: >> See the bug for more discussion and reproducer. This PR replaces the ad-hoc >> linked list with segmented list of arrays. Arrays are easy targets for GC. >> There are possible improvements here, most glaring is parallelism that is >>

Re: RFR: 8343704: Bad GC parallelism with processing Cleaner queues [v14]

2024-11-27 Thread Aleksey Shipilev
On Sat, 23 Nov 2024 01:38:00 GMT, Brent Christian wrote: >> Yes, this is a test that says "User allocated lots of Cleaner-carrying >> objects, and all of them are alive. See if GC chokes in this conditions." >> This is similar to the cases we are seeing in our prod conditions: these >> objects

Re: RFR: 8343704: Bad GC parallelism with processing Cleaner queues [v14]

2024-11-25 Thread Laurent Bourgès
On Mon, 25 Nov 2024 08:32:31 GMT, Aleksey Shipilev wrote: >> How about this: >> >>> ...the problem is in GC time hiccups to walk the large linked lists. >> >> Though, for this test, `CleanableList` itself is not being walked. >> >> Rather, `CleanableList` itself is a factor in as much as it ex

Re: RFR: 8343704: Bad GC parallelism with processing Cleaner queues [v14]

2024-11-25 Thread Aleksey Shipilev
On Sat, 23 Nov 2024 01:38:00 GMT, Brent Christian wrote: > Though, for this test, CleanableList itself is not being walked. I think this is a matter of definition of "CleanableList itself is not being walked". The Java code does not walk the list in this test, but GC does the walk the list a

Re: RFR: 8343704: Bad GC parallelism with processing Cleaner queues [v14]

2024-11-22 Thread Brent Christian
On Fri, 22 Nov 2024 06:59:45 GMT, Aleksey Shipilev wrote: >> Would this be considered a benchmark of the GC's PhantomReference >> management, then - deciding that all the `PhantomCleanerRef`s are still >> reachable, perhaps? >> >> To measure `CleanableList`'s list manipulation at GC-time, a `T

Re: RFR: 8343704: Bad GC parallelism with processing Cleaner queues [v15]

2024-11-22 Thread Aleksey Shipilev
On Fri, 22 Nov 2024 16:12:18 GMT, Viktor Klang wrote: >> Aleksey Shipilev has updated the pull request with a new target base due to >> a merge or a rebase. The incremental webrev excludes the unrelated changes >> brought in by the merge/rebase. The pull request contains 17 additional >> commi

Re: RFR: 8343704: Bad GC parallelism with processing Cleaner queues [v16]

2024-11-22 Thread Aleksey Shipilev
> See the bug for more discussion and reproducer. This PR replaces the ad-hoc > linked list with segmented list of arrays. Arrays are easy targets for GC. > There are possible improvements here, most glaring is parallelism that is > currently knee-capped by global synchronization. The synchroniz

Re: RFR: 8343704: Bad GC parallelism with processing Cleaner queues [v15]

2024-11-22 Thread Viktor Klang
On Thu, 21 Nov 2024 19:33:01 GMT, Aleksey Shipilev wrote: >> See the bug for more discussion and reproducer. This PR replaces the ad-hoc >> linked list with segmented list of arrays. Arrays are easy targets for GC. >> There are possible improvements here, most glaring is parallelism that is >>

Re: RFR: 8343704: Bad GC parallelism with processing Cleaner queues [v15]

2024-11-22 Thread Viktor Klang
On Thu, 21 Nov 2024 19:33:01 GMT, Aleksey Shipilev wrote: >> See the bug for more discussion and reproducer. This PR replaces the ad-hoc >> linked list with segmented list of arrays. Arrays are easy targets for GC. >> There are possible improvements here, most glaring is parallelism that is >>

Re: RFR: 8343704: Bad GC parallelism with processing Cleaner queues [v14]

2024-11-21 Thread Aleksey Shipilev
On Fri, 22 Nov 2024 00:17:19 GMT, Brent Christian wrote: >> Redone the benchmark. We actually want all targets to be reachable, and only >> expose the Cleaner-side linked lists to the test. New performance data is >> updated here: >> https://github.com/openjdk/jdk/pull/22043#issuecomment-24709

Re: RFR: 8343704: Bad GC parallelism with processing Cleaner queues [v14]

2024-11-21 Thread Brent Christian
On Thu, 21 Nov 2024 19:29:07 GMT, Aleksey Shipilev wrote: >> Ah (facepalms), I see, I thought I assigned it! Damn. Let me fix and >> re-measure. > > Redone the benchmark. We actually want all targets to be reachable, and only > expose the Cleaner-side linked lists to the test. New performance d

Re: RFR: 8343704: Bad GC parallelism with processing Cleaner queues [v14]

2024-11-21 Thread Aleksey Shipilev
On Thu, 21 Nov 2024 18:29:24 GMT, Aleksey Shipilev wrote: >> Sorry for being dense, but where is a value being set to `CleanerGC.prev` ? > > Ah (facepalms), I see, I thought I assigned it! Damn. Let me fix and > re-measure. Redone the benchmark. We actually want all targets to be reachable, and

Re: RFR: 8343704: Bad GC parallelism with processing Cleaner queues [v15]

2024-11-21 Thread Aleksey Shipilev
> See the bug for more discussion and reproducer. This PR replaces the ad-hoc > linked list with segmented list of arrays. Arrays are easy targets for GC. > There are possible improvements here, most glaring is parallelism that is > currently knee-capped by global synchronization. The synchroniz

Re: RFR: 8343704: Bad GC parallelism with processing Cleaner queues [v14]

2024-11-21 Thread Aleksey Shipilev
On Thu, 21 Nov 2024 18:20:10 GMT, Brent Christian wrote: >> No. Local `prev` variable goes out of scope when `setup()` finishes, making >> the whole thing eligible for GC. We need something that keeps the list >> alive, like a benchmark object field, which `CleanerGC.prev` is. > > Sorry for bei

Re: RFR: 8343704: Bad GC parallelism with processing Cleaner queues [v14]

2024-11-21 Thread Brent Christian
On Thu, 21 Nov 2024 18:02:24 GMT, Aleksey Shipilev wrote: >> Doesn't it get covered by the local `prev` in `setup()`? Should that be >> removed? > > No. Local `prev` variable goes out of scope when `setup()` finishes, making > the whole thing eligible for GC. We need something that keeps the li

Re: RFR: 8343704: Bad GC parallelism with processing Cleaner queues [v14]

2024-11-21 Thread Aleksey Shipilev
On Thu, 21 Nov 2024 17:53:00 GMT, Brent Christian wrote: >> Yes. It maintains the root of a reachable linked list of `Target`-s. > > Doesn't it get covered by the local `prev` in `setup()`? Should that be > removed? No. Local `prev` variable goes out of scope when `setup()` finishes, making the

Re: RFR: 8343704: Bad GC parallelism with processing Cleaner queues [v14]

2024-11-21 Thread Brent Christian
On Thu, 21 Nov 2024 07:11:00 GMT, Aleksey Shipilev wrote: >> test/micro/org/openjdk/bench/java/lang/ref/CleanerGC.java line 45: >> >>> 43: >>> 44: // Deliberately a linked list to avoid exposing external >>> parallelism to GC. >>> 45: Target prev; >> >> Is `CleanerGC.prev` used? > > Y

Re: RFR: 8343704: Bad GC parallelism with processing Cleaner queues [v14]

2024-11-20 Thread Aleksey Shipilev
On Thu, 21 Nov 2024 05:42:09 GMT, Brent Christian wrote: >> Aleksey Shipilev has updated the pull request incrementally with one >> additional commit since the last revision: >> >> Check all elements are removable after random test > > test/micro/org/openjdk/bench/java/lang/ref/CleanerGC.java

Re: RFR: 8343704: Bad GC parallelism with processing Cleaner queues [v14]

2024-11-20 Thread Brent Christian
On Wed, 20 Nov 2024 09:19:39 GMT, Aleksey Shipilev wrote: >> See the bug for more discussion and reproducer. This PR replaces the ad-hoc >> linked list with segmented list of arrays. Arrays are easy targets for GC. >> There are possible improvements here, most glaring is parallelism that is >>

Re: RFR: 8343704: Bad GC parallelism with processing Cleaner queues [v12]

2024-11-20 Thread Roger Riggs
On Tue, 19 Nov 2024 08:09:38 GMT, Aleksey Shipilev wrote: >> See the bug for more discussion and reproducer. This PR replaces the ad-hoc >> linked list with segmented list of arrays. Arrays are easy targets for GC. >> There are possible improvements here, most glaring is parallelism that is >>

Re: RFR: 8343704: Bad GC parallelism with processing Cleaner queues [v14]

2024-11-20 Thread Aleksey Shipilev
> See the bug for more discussion and reproducer. This PR replaces the ad-hoc > linked list with segmented list of arrays. Arrays are easy targets for GC. > There are possible improvements here, most glaring is parallelism that is > currently knee-capped by global synchronization. The synchroniz

Re: RFR: 8343704: Bad GC parallelism with processing Cleaner queues [v13]

2024-11-20 Thread Aleksey Shipilev
On Wed, 20 Nov 2024 00:50:01 GMT, Brent Christian wrote: >> Aleksey Shipilev has updated the pull request incrementally with one >> additional commit since the last revision: >> >> Use RandomFactory in test > > src/java.base/share/classes/jdk/internal/ref/PhantomCleanable.java line 55: > >>

Re: RFR: 8343704: Bad GC parallelism with processing Cleaner queues [v12]

2024-11-20 Thread Aleksey Shipilev
On Tue, 19 Nov 2024 18:50:36 GMT, Roger Riggs wrote: > With SM removal, there is a doPrivileged call in Cleaner.java. Should that be > handled separately from this PR? Since this is not related to the problem at hand, I'd prefer to keep it out of this PR. - PR Comment: https://gi

Re: RFR: 8343704: Bad GC parallelism with processing Cleaner queues [v13]

2024-11-19 Thread Brent Christian
On Tue, 19 Nov 2024 19:53:45 GMT, Aleksey Shipilev wrote: >> See the bug for more discussion and reproducer. This PR replaces the ad-hoc >> linked list with segmented list of arrays. Arrays are easy targets for GC. >> There are possible improvements here, most glaring is parallelism that is >>

Re: RFR: 8343704: Bad GC parallelism with processing Cleaner queues [v13]

2024-11-19 Thread Brent Christian
On Tue, 19 Nov 2024 19:53:45 GMT, Aleksey Shipilev wrote: >> See the bug for more discussion and reproducer. This PR replaces the ad-hoc >> linked list with segmented list of arrays. Arrays are easy targets for GC. >> There are possible improvements here, most glaring is parallelism that is >>

Re: RFR: 8343704: Bad GC parallelism with processing Cleaner queues [v12]

2024-11-19 Thread Aleksey Shipilev
On Tue, 19 Nov 2024 19:19:51 GMT, Brent Christian wrote: >> Aleksey Shipilev has updated the pull request with a new target base due to >> a merge or a rebase. The incremental webrev excludes the unrelated changes >> brought in by the merge/rebase. The pull request contains 13 additional >> co

Re: RFR: 8343704: Bad GC parallelism with processing Cleaner queues [v13]

2024-11-19 Thread Aleksey Shipilev
> See the bug for more discussion and reproducer. This PR replaces the ad-hoc > linked list with segmented list of arrays. Arrays are easy targets for GC. > There are possible improvements here, most glaring is parallelism that is > currently knee-capped by global synchronization. The synchroniz

Re: RFR: 8343704: Bad GC parallelism with processing Cleaner queues [v12]

2024-11-19 Thread Aleksey Shipilev
On Tue, 19 Nov 2024 19:26:03 GMT, Aleksey Shipilev wrote: > > With SM removal, there is a doPrivileged call in Cleaner.java. Should that > > be handled separately from this PR? > > Since this is not related to the problem at hand, I'd prefer to keep it out > of this PR. Actually, I wonder if

Re: RFR: 8343704: Bad GC parallelism with processing Cleaner queues [v12]

2024-11-19 Thread Brent Christian
On Tue, 19 Nov 2024 08:09:38 GMT, Aleksey Shipilev wrote: >> See the bug for more discussion and reproducer. This PR replaces the ad-hoc >> linked list with segmented list of arrays. Arrays are easy targets for GC. >> There are possible improvements here, most glaring is parallelism that is >>

Re: RFR: 8343704: Bad GC parallelism with processing Cleaner queues [v12]

2024-11-19 Thread Roger Riggs
On Tue, 19 Nov 2024 08:09:38 GMT, Aleksey Shipilev wrote: >> See the bug for more discussion and reproducer. This PR replaces the ad-hoc >> linked list with segmented list of arrays. Arrays are easy targets for GC. >> There are possible improvements here, most glaring is parallelism that is >>

Re: RFR: 8343704: Bad GC parallelism with processing Cleaner queues [v12]

2024-11-19 Thread Aleksey Shipilev
> See the bug for more discussion and reproducer. This PR replaces the ad-hoc > linked list with segmented list of arrays. Arrays are easy targets for GC. > There are possible improvements here, most glaring is parallelism that is > currently knee-capped by global synchronization. The synchroniz

Re: RFR: 8343704: Bad GC parallelism with processing Cleaner queues [v11]

2024-11-19 Thread Aleksey Shipilev
On Tue, 19 Nov 2024 00:58:18 GMT, Brent Christian wrote: >> Aleksey Shipilev has updated the pull request incrementally with one >> additional commit since the last revision: >> >> Drop --add-exports from the test > > test/jdk/jdk/internal/ref/Cleaner/CleanableListTest.java line 46: > >> 44:

Re: RFR: 8343704: Bad GC parallelism with processing Cleaner queues [v10]

2024-11-19 Thread Aleksey Shipilev
On Sat, 16 Nov 2024 00:03:18 GMT, Brent Christian wrote: >> Aleksey Shipilev has updated the pull request incrementally with one >> additional commit since the last revision: >> >> prev is not needed > > src/java.base/share/classes/jdk/internal/ref/CleanerImpl.java line 239: > >> 237:

Re: RFR: 8343704: Bad GC parallelism with processing Cleaner queues [v11]

2024-11-18 Thread Brent Christian
On Mon, 18 Nov 2024 09:46:50 GMT, Aleksey Shipilev wrote: >> See the bug for more discussion and reproducer. This PR replaces the ad-hoc >> linked list with segmented list of arrays. Arrays are easy targets for GC. >> There are possible improvements here, most glaring is parallelism that is >>

Re: RFR: 8343704: Bad GC parallelism with processing Cleaner queues [v10]

2024-11-18 Thread Brent Christian
On Fri, 15 Nov 2024 19:30:06 GMT, Aleksey Shipilev wrote: >> See the bug for more discussion and reproducer. This PR replaces the ad-hoc >> linked list with segmented list of arrays. Arrays are easy targets for GC. >> There are possible improvements here, most glaring is parallelism that is >>

Re: RFR: 8343704: Bad GC parallelism with processing Cleaner queues [v10]

2024-11-18 Thread Aleksey Shipilev
On Fri, 15 Nov 2024 21:31:54 GMT, Brent Christian wrote: >> Aleksey Shipilev has updated the pull request incrementally with one >> additional commit since the last revision: >> >> prev is not needed > > src/java.base/share/classes/jdk/internal/ref/CleanerImpl.java line 310: > >> 308:

Re: RFR: 8343704: Bad GC parallelism with processing Cleaner queues [v11]

2024-11-18 Thread Aleksey Shipilev
> See the bug for more discussion and reproducer. This PR replaces the ad-hoc > linked list with segmented list of arrays. Arrays are easy targets for GC. > There are possible improvements here, most glaring is parallelism that is > currently knee-capped by global synchronization. The synchroniz

Re: RFR: 8343704: Bad GC parallelism with processing Cleaner queues [v10]

2024-11-18 Thread Aleksey Shipilev
On Sat, 16 Nov 2024 18:11:32 GMT, Chen Liang wrote: >> Aleksey Shipilev has updated the pull request incrementally with one >> additional commit since the last revision: >> >> prev is not needed > > test/jdk/jdk/internal/ref/Cleaner/CleanableListTest.java line 30: > >> 28: * @compile/module

Re: RFR: 8343704: Bad GC parallelism with processing Cleaner queues [v10]

2024-11-16 Thread Chen Liang
On Fri, 15 Nov 2024 19:30:06 GMT, Aleksey Shipilev wrote: >> See the bug for more discussion and reproducer. This PR replaces the ad-hoc >> linked list with segmented list of arrays. Arrays are easy targets for GC. >> There are possible improvements here, most glaring is parallelism that is >>

Re: RFR: 8343704: Bad GC parallelism with processing Cleaner queues [v10]

2024-11-16 Thread Kelvin Nilsen
On Fri, 15 Nov 2024 19:30:06 GMT, Aleksey Shipilev wrote: >> See the bug for more discussion and reproducer. This PR replaces the ad-hoc >> linked list with segmented list of arrays. Arrays are easy targets for GC. >> There are possible improvements here, most glaring is parallelism that is >>

Re: RFR: 8343704: Bad GC parallelism with processing Cleaner queues [v9]

2024-11-15 Thread Aleksey Shipilev
On Fri, 15 Nov 2024 17:55:30 GMT, Chen Liang wrote: >> Aleksey Shipilev has updated the pull request incrementally with one >> additional commit since the last revision: >> >> Do not need -ea -esa in tests, our testing infra adds them already > > src/java.base/share/classes/jdk/internal/ref/C

Re: RFR: 8343704: Bad GC parallelism with processing Cleaner queues [v10]

2024-11-15 Thread Brent Christian
On Fri, 15 Nov 2024 19:30:06 GMT, Aleksey Shipilev wrote: >> See the bug for more discussion and reproducer. This PR replaces the ad-hoc >> linked list with segmented list of arrays. Arrays are easy targets for GC. >> There are possible improvements here, most glaring is parallelism that is >>

Re: RFR: 8343704: Bad GC parallelism with processing Cleaner queues [v10]

2024-11-15 Thread Aleksey Shipilev
> See the bug for more discussion and reproducer. This PR replaces the ad-hoc > linked list with segmented list of arrays. Arrays are easy targets for GC. > There are possible improvements here, most glaring is parallelism that is > currently knee-capped by global synchronization. The synchroniz

Re: RFR: 8343704: Bad GC parallelism with processing Cleaner queues [v9]

2024-11-15 Thread Aleksey Shipilev
On Fri, 15 Nov 2024 17:53:53 GMT, Chen Liang wrote: >> Aleksey Shipilev has updated the pull request incrementally with one >> additional commit since the last revision: >> >> Do not need -ea -esa in tests, our testing infra adds them already > > src/java.base/share/classes/jdk/internal/ref/C

Re: RFR: 8343704: Bad GC parallelism with processing Cleaner queues [v8]

2024-11-15 Thread Brent Christian
On Fri, 15 Nov 2024 10:11:38 GMT, Francesco Nigro wrote: > ...in case having a lock-free structure can be of any help, in JCTools we > have... We should continue to lock the same lock in `insert()` and `remove()`, as it creates the _happens-before_ between the thread registering the `Cleaner`,

Re: RFR: 8343704: Bad GC parallelism with processing Cleaner queues [v9]

2024-11-15 Thread Chen Liang
On Fri, 15 Nov 2024 10:19:46 GMT, Aleksey Shipilev wrote: >> See the bug for more discussion and reproducer. This PR replaces the ad-hoc >> linked list with segmented list of arrays. Arrays are easy targets for GC. >> There are possible improvements here, most glaring is parallelism that is >>

Re: RFR: 8343704: Bad GC parallelism with processing Cleaner queues [v8]

2024-11-15 Thread Francesco Nigro
On Fri, 15 Nov 2024 10:05:29 GMT, Aleksey Shipilev wrote: >> See the bug for more discussion and reproducer. This PR replaces the ad-hoc >> linked list segmented list of arrays. Arrays are easy targets for GC. There >> are possible improvements here, most glaring is parallelism that is >> curr

Re: RFR: 8343704: Bad GC parallelism with processing Cleaner queues [v4]

2024-11-15 Thread Aleksey Shipilev
On Fri, 15 Nov 2024 06:36:22 GMT, Alan Bateman wrote: >>> I see that existing `Cleaner` tests are quite rich already. >>> ... >>> The new asserts around that code should IMO test enough with existing tests. >> >> Should any of the existing `Cleaner` tests have `@run`s added with `-esa` ? > > Ru

Re: RFR: 8343704: Bad GC parallelism with processing Cleaner queues [v9]

2024-11-15 Thread Aleksey Shipilev
> See the bug for more discussion and reproducer. This PR replaces the ad-hoc > linked list segmented list of arrays. Arrays are easy targets for GC. There > are possible improvements here, most glaring is parallelism that is currently > knee-capped by global synchronization. The synchronization

Re: RFR: 8343704: Bad GC parallelism with processing Cleaner queues [v7]

2024-11-15 Thread Aleksey Shipilev
On Fri, 15 Nov 2024 07:32:37 GMT, Axel Boldt-Christmas wrote: > > I have been playing with > > [8343704-node-cache.txt](https://github.com/user-attachments/files/17753986/8343704-node-cache.txt) > > -- is that what you had in mind? > > Yes. It amortises the allocation over at least NODE_CAPAC

Re: RFR: 8343704: Bad GC parallelism with processing Cleaner queues [v8]

2024-11-15 Thread Aleksey Shipilev
> See the bug for more discussion and reproducer. This PR replaces the ad-hoc > linked list segmented list of arrays. Arrays are easy targets for GC. There > are possible improvements here, most glaring is parallelism that is currently > knee-capped by global synchronization. The synchronization

Re: RFR: 8343704: Bad GC parallelism with processing Cleaner queues [v7]

2024-11-14 Thread Axel Boldt-Christmas
On Thu, 14 Nov 2024 17:26:31 GMT, Aleksey Shipilev wrote: > > That is probably correct. I was however thinking that it would only be > > pooled asymmetrically as some type of hystereses. So you pool when you > > remove a node (switch the head) and keep it far an arbitrary amount of > > removal

Re: RFR: 8343704: Bad GC parallelism with processing Cleaner queues [v4]

2024-11-14 Thread Alan Bateman
On Thu, 14 Nov 2024 21:03:35 GMT, Brent Christian wrote: >> Nevermind, I added a directed regression test for it now. > >> I see that existing `Cleaner` tests are quite rich already. >> ... >> The new asserts around that code should IMO test enough with existing tests. > > Should any of the exi

Re: RFR: 8343704: Bad GC parallelism with processing Cleaner queues [v4]

2024-11-14 Thread Brent Christian
On Thu, 14 Nov 2024 13:20:06 GMT, Aleksey Shipilev wrote: >> I see that existing `Cleaner` tests are quite rich already. Array-based >> implementation does rise question about testing the resizes, that's obvious. >> But I have discovered that copying arrays is not really that good in this >> s

Re: RFR: 8343704: Bad GC parallelism with processing Cleaner queues [v7]

2024-11-14 Thread Aleksey Shipilev
On Thu, 14 Nov 2024 14:50:21 GMT, Axel Boldt-Christmas wrote: > That is probably correct. I was however thinking that it would only be pooled > asymmetrically as some type of hystereses. So you pool when you remove a node > (switch the head) and keep it far an arbitrary amount of removals. So

Re: RFR: 8343704: Bad GC parallelism with processing Cleaner queues [v7]

2024-11-14 Thread Aleksey Shipilev
On Thu, 14 Nov 2024 14:50:21 GMT, Axel Boldt-Christmas wrote: > I was however thinking that it would only be pooled asymmetrically as some > type of hystereses. So you pool when you remove a node (switch the head) and > keep it far an arbitrary amount of removals. So it would only really waste

Re: RFR: 8343704: Bad GC parallelism with processing Cleaner queues [v7]

2024-11-14 Thread Oli Gillespie
On Thu, 14 Nov 2024 13:24:26 GMT, Aleksey Shipilev wrote: >> See the bug for more discussion and reproducer. This PR replaces the ad-hoc >> linked list segmented list of arrays. Arrays are easy targets for GC. There >> are possible improvements here, most glaring is parallelism that is >> curr

Re: RFR: 8343704: Bad GC parallelism with processing Cleaner queues [v7]

2024-11-14 Thread Axel Boldt-Christmas
On Thu, 14 Nov 2024 13:56:03 GMT, Aleksey Shipilev wrote: > I don't think we should care about this case: it seems the rare benefit does > not outweigh the cost for common case? The goal for this implementation is to > avoid wasting more space than necessary. Caching a node would take another

Re: RFR: 8343704: Bad GC parallelism with processing Cleaner queues [v7]

2024-11-14 Thread Aleksey Shipilev
On Thu, 14 Nov 2024 13:28:46 GMT, Axel Boldt-Christmas wrote: > This seem to handle excessive allocations when churning around an empty list > by keeping the head node always allocated. Realistically, the list is almost never empty: there is a `Cleaner` instance itself recorded in the list.

Re: RFR: 8343704: Bad GC parallelism with processing Cleaner queues [v7]

2024-11-14 Thread Axel Boldt-Christmas
On Thu, 14 Nov 2024 13:24:26 GMT, Aleksey Shipilev wrote: >> See the bug for more discussion and reproducer. This PR replaces the ad-hoc >> linked list segmented list of arrays. Arrays are easy targets for GC. There >> are possible improvements here, most glaring is parallelism that is >> curr

Re: RFR: 8343704: Bad GC parallelism with processing Cleaner queues [v4]

2024-11-14 Thread Aleksey Shipilev
On Thu, 14 Nov 2024 10:00:24 GMT, Aleksey Shipilev wrote: >> Speaking of testing, with this level of change, perhaps a new (white box?) >> regtest is warranted. > > I see that existing `Cleaner` tests are quite rich already. Array-based > implementation does rise question about testing the resi

Re: RFR: 8343704: Bad GC parallelism with processing Cleaner queues [v6]

2024-11-14 Thread Aleksey Shipilev
On Thu, 14 Nov 2024 11:50:31 GMT, Oli Gillespie wrote: >> Aleksey Shipilev has updated the pull request incrementally with one >> additional commit since the last revision: >> >> Reimplement with segmented linked list of arrays > > src/java.base/share/classes/jdk/internal/ref/CleanerImpl.java

Re: RFR: 8343704: Bad GC parallelism with processing Cleaner queues [v7]

2024-11-14 Thread Aleksey Shipilev
> See the bug for more discussion and reproducer. This PR replaces the ad-hoc > linked list segmented list of arrays. Arrays are easy targets for GC. There > are possible improvements here, most glaring is parallelism that is currently > knee-capped by global synchronization. The synchronization

Re: RFR: 8343704: Bad GC parallelism with processing Cleaner queues [v6]

2024-11-14 Thread Oli Gillespie
On Thu, 14 Nov 2024 10:04:04 GMT, Aleksey Shipilev wrote: >> See the bug for more discussion and reproducer. This PR replaces the ad-hoc >> linked list segmented list of arrays. Arrays are easy targets for GC. There >> are possible improvements here, most glaring is parallelism that is >> curr

Re: RFR: 8343704: Bad GC parallelism with processing Cleaner queues [v4]

2024-11-14 Thread Aleksey Shipilev
On Thu, 14 Nov 2024 00:30:27 GMT, Brent Christian wrote: >> I pushed the array-based implementation, but ran out of time to properly >> test it. I'll circle back to it tomorrow. Review if you can, but it will >> probably have some touchups later. > > Speaking of testing, with this level of chan

Re: RFR: 8343704: Bad GC parallelism with processing Cleaner queues [v6]

2024-11-14 Thread Aleksey Shipilev
> See the bug for more discussion and reproducer. This PR replaces the ad-hoc > linked list with the `ArrayList` wrapper that manages synchronization, search > and replacements efficiently. Arrays are easy targets for GC. There are > possible improvements here, most glaring is parallelism that i

Re: RFR: 8343704: Bad GC parallelism with processing Cleaner queues [v5]

2024-11-14 Thread Aleksey Shipilev
On Thu, 14 Nov 2024 00:50:51 GMT, Chen Liang wrote: >> Aleksey Shipilev has updated the pull request incrementally with one >> additional commit since the last revision: >> >> Review feedback: make sure trimming actually works, stylistic changes > > src/java.base/share/classes/jdk/internal/re

Re: RFR: 8343704: Bad GC parallelism with processing Cleaner queues [v5]

2024-11-13 Thread Chen Liang
On Wed, 13 Nov 2024 20:33:25 GMT, Aleksey Shipilev wrote: >> See the bug for more discussion and reproducer. This PR replaces the ad-hoc >> linked list with the `ArrayList` wrapper that manages synchronization, >> search and replacements efficiently. Arrays are easy targets for GC. There >> ar

Re: RFR: 8343704: Bad GC parallelism with processing Cleaner queues [v4]

2024-11-13 Thread Brent Christian
On Wed, 13 Nov 2024 20:46:09 GMT, Aleksey Shipilev wrote: >> Right, d'oh. The unavailability of `ArrayList.capacity()` is what gets us in >> this mess. I'll try to rewrite to just plain arrays. > > I pushed the array-based implementation, but ran out of time to properly test > it. I'll circle b

Re: RFR: 8343704: Bad GC parallelism with processing Cleaner queues [v4]

2024-11-13 Thread Aleksey Shipilev
On Wed, 13 Nov 2024 19:00:34 GMT, Aleksey Shipilev wrote: >> src/java.base/share/classes/jdk/internal/ref/CleanerImpl.java line 290: >> >>> 288: list.remove(lastIdx); >>> 289: >>> 290: // Capacity control: trim the backing storage if it >>> looks like >> >> I t

Re: RFR: 8343704: Bad GC parallelism with processing Cleaner queues [v4]

2024-11-13 Thread Aleksey Shipilev
On Wed, 13 Nov 2024 17:22:21 GMT, Kelvin Nilsen wrote: >> Aleksey Shipilev has updated the pull request with a new target base due to >> a merge or a rebase. The incremental webrev excludes the unrelated changes >> brought in by the merge/rebase. The pull request contains four additional >> co

Re: RFR: 8343704: Bad GC parallelism with processing Cleaner queues [v5]

2024-11-13 Thread Aleksey Shipilev
> See the bug for more discussion and reproducer. This PR replaces the ad-hoc > linked list with the `ArrayList` wrapper that manages synchronization, search > and replacements efficiently. Arrays are easy targets for GC. There are > possible improvements here, most glaring is parallelism that i

Re: RFR: 8343704: Bad GC parallelism with processing Cleaner queues [v4]

2024-11-13 Thread Brent Christian
On Wed, 13 Nov 2024 08:16:31 GMT, Aleksey Shipilev wrote: >> src/java.base/share/classes/jdk/internal/ref/CleanerImpl.java line 300: >> >>> 298: return true; >>> 299: } >>> 300: } >> >> It looks like the new `PhantomCleanableList.remove()` puts 100% trust in

Re: RFR: 8343704: Bad GC parallelism with processing Cleaner queues [v4]

2024-11-13 Thread Aleksey Shipilev
On Wed, 13 Nov 2024 17:19:18 GMT, Kelvin Nilsen wrote: >> Aleksey Shipilev has updated the pull request with a new target base due to >> a merge or a rebase. The incremental webrev excludes the unrelated changes >> brought in by the merge/rebase. The pull request contains four additional >> co

Re: RFR: 8343704: Bad GC parallelism with processing Cleaner queues [v4]

2024-11-13 Thread Kelvin Nilsen
On Wed, 13 Nov 2024 15:38:35 GMT, Aleksey Shipilev wrote: >> See the bug for more discussion and reproducer. This PR replaces the ad-hoc >> linked list with the `ArrayList` wrapper that manages synchronization, >> search and replacements efficiently. Arrays are easy targets for GC. There >> ar

Re: RFR: 8343704: Bad GC parallelism with processing Cleaner queues [v4]

2024-11-13 Thread Aleksey Shipilev
> See the bug for more discussion and reproducer. This PR replaces the ad-hoc > linked list with the `ArrayList` wrapper that manages synchronization, search > and replacements efficiently. Arrays are easy targets for GC. There are > possible improvements here, most glaring is parallelism that i

Re: RFR: 8343704: Bad GC parallelism with processing Cleaner queues [v2]

2024-11-13 Thread Aleksey Shipilev
> See the bug for more discussion and reproducer. This PR replaces the ad-hoc > linked list with the `ArrayList` wrapper that manages synchronization, search > and replacements efficiently. Arrays are easy targets for GC. There are > possible improvements here, most glaring is parallelism that i

Re: RFR: 8343704: Bad GC parallelism with processing Cleaner queues [v3]

2024-11-13 Thread Aleksey Shipilev
> See the bug for more discussion and reproducer. This PR replaces the ad-hoc > linked list with the `ArrayList` wrapper that manages synchronization, search > and replacements efficiently. Arrays are easy targets for GC. There are > possible improvements here, most glaring is parallelism that i

Re: RFR: 8343704: Bad GC parallelism with processing Cleaner queues [v2]

2024-11-13 Thread Aleksey Shipilev
On Wed, 13 Nov 2024 00:30:37 GMT, Brent Christian wrote: >> Aleksey Shipilev has updated the pull request incrementally with one >> additional commit since the last revision: >> >> Touchups: assert index, polish commits > > src/java.base/share/classes/jdk/internal/ref/CleanerImpl.java line 30

Re: RFR: 8343704: Bad GC parallelism with processing Cleaner queues

2024-11-12 Thread Brent Christian
On Tue, 12 Nov 2024 16:00:39 GMT, Aleksey Shipilev wrote: > See the bug for more discussion and reproducer. This PR replaces the ad-hoc > linked list with the `ArrayList` wrapper that manages synchronization, search > and replacements efficiently. Arrays are easy targets for GC. There are > po

Re: RFR: 8343704: Bad GC parallelism with processing Cleaner queues

2024-11-12 Thread Aleksey Shipilev
On Tue, 12 Nov 2024 16:00:39 GMT, Aleksey Shipilev wrote: > See the bug for more discussion and reproducer. This PR replaces the linked > list with an `ArrayList` wrapper that manages synchronization, search and > replacements effectively. There are possible improvements here, most glaring > i

RFR: 8343704: Bad GC parallelism with processing Cleaner queues

2024-11-12 Thread Aleksey Shipilev
See the bug for more discussion and reproducer. This PR replaces the linked list with an `ArrayList` wrapper that manages synchronization, search and replacements effectively. There are possible improvements here, most glaring is parallelism that is currently knee-capped by global synchronizatio