RFR: 8321242: Enable WorkerThreads to run tasks in caller thread [v6]
Kim Barrett
kbarrett at openjdk.org
Mon Dec 11 00:14:16 UTC 2023
On Wed, 6 Dec 2023 08:52:33 GMT, Stefan Karlsson <stefank at openjdk.org> wrote:
>> I would say it is a matter of hygiene. If we access things with Atomics, e.g. for CASes, then we should be doing atomic accesses everywhere else. In case some platforms do something specific for atomics to work. There is a CAS for `_not_finished` in `WorkerTaskDispatcher::worker_run_task`. I guess we want the same for `_started`.
>
> The counter-argument is that when you see the Atomic::store you think that there must be some concurrent access happening, but there are none and the reader was just mislead by the Atomic::store.
Since I made the suggestion - The rationale for using Atomic::store here is
that _not_finished is conceptually an atomic variable, and we should always
manipulate atomic variables using Atomic operations. It was ErikO who first
espoused that style, and I thought there was general agreement on it.
(I think it would be good to have an actual atomic variable class in HotSpot.
Leo offered a prototype a while ago, but there were some problems with it and
some lack of consensus around some parts, and it got put aside. I might be
misremembering, but I think some of the problems were around things that could
be dealt with using newer language features that we didn't have available at
the time. I keep thinking about revisiting that area, but haven't gotten
around to it, in part because I think I want C++17 for some things.)
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/16945#discussion_r1421846491
More information about the hotspot-gc-dev
mailing list