< prev index next >
src/hotspot/share/gc/shared/taskTerminator.hpp
Print this page
rev 60497 : [mq]: 8245721-kbarrett-review2
*** 43,80 ****
* "Wessam Hassanein. 2016. Understanding and improving JVM GC work
* stealing at the data center scale. In Proceedings of the 2016 ACM
* SIGPLAN International Symposium on Memory Management (ISMM 2016). ACM,
* New York, NY, USA, 46-54. DOI: https://doi.org/10.1145/2926697.2926706"
*
! * Instead of a dedicated spin-master, our implementation will let spin-master relinquish
! * the role before it goes to sleep/wait, allowing newly arrived threads to compete for the role.
! * The intention of above enhancement is to reduce spin-master's latency on detecting new tasks
! * for stealing and termination condition.
*/
class TaskTerminator : public CHeapObj<mtGC> {
! struct DelayContext {
uint _yield_count;
// Number of hard spin loops done since last yield
uint _hard_spin_count;
! // Number of iterations in the hard spin loop.
uint _hard_spin_limit;
DelayContext();
};
uint _n_threads;
TaskQueueSetSuper* _queue_set;
DEFINE_PAD_MINUS_SIZE(0, DEFAULT_CACHE_LINE_SIZE, 0);
volatile uint _offered_termination;
DEFINE_PAD_MINUS_SIZE(1, DEFAULT_CACHE_LINE_SIZE, sizeof(volatile uint));
- void assert_queue_set_empty() const NOT_DEBUG_RETURN;
-
Monitor _blocker;
Thread* _spin_master;
// Prepare for return from offer_termination. Gives up the spin master token
// and wakes up up to tasks threads waiting on _blocker (the default value
// means to wake up everyone).
void prepare_for_return(Thread* this_thread, size_t tasks = SIZE_MAX);
--- 43,88 ----
* "Wessam Hassanein. 2016. Understanding and improving JVM GC work
* stealing at the data center scale. In Proceedings of the 2016 ACM
* SIGPLAN International Symposium on Memory Management (ISMM 2016). ACM,
* New York, NY, USA, 46-54. DOI: https://doi.org/10.1145/2926697.2926706"
*
! * Instead of a dedicated spin-master, our implementation will let spin-master
! * relinquish the role before it goes to sleep/wait, allowing newly arrived
! * threads to compete for the role.
! * The intention of above enhancement is to reduce spin-master's latency on
! * detecting new tasks for stealing and termination condition.
*/
class TaskTerminator : public CHeapObj<mtGC> {
! class DelayContext {
uint _yield_count;
// Number of hard spin loops done since last yield
uint _hard_spin_count;
! // Number of iterations in the current hard spin loop.
uint _hard_spin_limit;
+ void reset_hard_spin_information();
+ public:
DelayContext();
+
+ // Should the caller sleep (wait) or perform a spin step?
+ bool needs_sleep() const;
+ // Perform one delay iteration.
+ void do_step();
};
uint _n_threads;
TaskQueueSetSuper* _queue_set;
DEFINE_PAD_MINUS_SIZE(0, DEFAULT_CACHE_LINE_SIZE, 0);
volatile uint _offered_termination;
DEFINE_PAD_MINUS_SIZE(1, DEFAULT_CACHE_LINE_SIZE, sizeof(volatile uint));
Monitor _blocker;
Thread* _spin_master;
+ void assert_queue_set_empty() const NOT_DEBUG_RETURN;
+
// Prepare for return from offer_termination. Gives up the spin master token
// and wakes up up to tasks threads waiting on _blocker (the default value
// means to wake up everyone).
void prepare_for_return(Thread* this_thread, size_t tasks = SIZE_MAX);
*** 82,92 ****
bool exit_termination(size_t tasks, TerminatorTerminator* terminator);
size_t tasks_in_queue_set() const;
// Perform one iteration of spin-master work.
! bool do_delay_step(DelayContext& delay_context);
NONCOPYABLE(TaskTerminator);
public:
TaskTerminator(uint n_threads, TaskQueueSetSuper* queue_set);
--- 90,100 ----
bool exit_termination(size_t tasks, TerminatorTerminator* terminator);
size_t tasks_in_queue_set() const;
// Perform one iteration of spin-master work.
! void do_delay_step(DelayContext& delay_context);
NONCOPYABLE(TaskTerminator);
public:
TaskTerminator(uint n_threads, TaskQueueSetSuper* queue_set);
< prev index next >