RFR (S): 8155232: Augment Workgang to run task with a given number of threads

Stefan Karlsson stefan.karlsson at oracle.com
Thu Apr 28 11:58:43 UTC 2016

Hi Thomas,

This change looks fine.

I have a slight reservation about using the word "thread" in this 
context, since the tasks might be executed on a lower number of threads. 
The surrounding code uses the word "workers" instead of "threads". Maybe 
your function code be named run_task_on_workers, or maybe even use an 
overloaded run_task function?


On 2016-04-28 13:15, Thomas Schatzl wrote:
> Hi all,
>    can I have reviews for this small change that eases use of variable
> number of threads for a given task?
> Instead of longish
> size_t new_active_threads = ...
> size_t old_active_threads = gang->num_active_threads();
> gang->set_active_threads(new_active_threads);
> gang->run_task(...);
> gang->set_active_threads(old_active_threads);
> you can do
> gang->run_task_with_threads(..., new_active_threads);
> The method treats the existing number of active threads as the maximum
> number of threads that may be used.
> This is part of an effort to not hold up actual improvements on thread
> usage due to trying to change where the number of active threads are
> stored. The WorkGang might not be the best place to do so.
> I am currently investigating several variants in JDK-8155093.
> CR:
> https://bugs.openjdk.java.net/browse/JDK-8155232
> Webrev:
> http://cr.openjdk.java.net/~tschatzl/8155232/webrev/
> Testing:
> vm.gc, jprt
> Thanks,
>    Thomas

More information about the hotspot-gc-dev mailing list