RFR: 8312023: Parallel pretouch should shortcut when only 1 thread is needed [v2]
Thomas Schatzl
tschatzl at openjdk.org
Fri Dec 1 09:06:07 UTC 2023
On Fri, 1 Dec 2023 00:44:38 GMT, Kim Barrett <kbarrett at openjdk.org> wrote:
> > > There may have been some concern that some task might care about the kind of thread it runs on?
> >
> >
> > Exactly, in generic case you don't know if caller thread is set up to do the task in the way the worker threads are. This pretouching code is one of the cases where we know running in caller is fine. Existing code even does it when no worker pool is available.
>
> That's easily dealt with. Provide a configuration mechanism (a boolean argument for run_task or a variant of run_task with a different name) that controls whether running on the current thread is permitted and defaults to no. Then let clients opt in to that feature. In my opinion that's a lot better than having each client that can run on the current thread provide an ad hoc implementation for doing so.
I concur with @kimbarrett: although being guilty of accepting such changes, there has been an effort in the past to *remove* the per-caller `task.work(0)` for the reason that it just adds lots of code duplication, with the goal of eventually providing a way to have any client interested opt in without code duplication. Please add a way to have clients opt in for any task as Kim suggests.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/16882#issuecomment-1835723164
More information about the hotspot-gc-dev
mailing list