mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 14:54:52 +02:00
6690928: Use spinning in combination with yields for workstealing termination
Substitute a spin loop for most calls to yield() to reduce the stress on the system. Reviewed-by: tonyp
This commit is contained in:
parent
61181babf1
commit
3b5d6a04dd
9 changed files with 116 additions and 4 deletions
|
@ -426,12 +426,20 @@ public:
|
|||
// A class to aid in the termination of a set of parallel tasks using
|
||||
// TaskQueueSet's for work stealing.
|
||||
|
||||
#undef TRACESPINNING
|
||||
|
||||
class ParallelTaskTerminator: public StackObj {
|
||||
private:
|
||||
int _n_threads;
|
||||
TaskQueueSetSuper* _queue_set;
|
||||
int _offered_termination;
|
||||
|
||||
#ifdef TRACESPINNING
|
||||
static uint _total_yields;
|
||||
static uint _total_spins;
|
||||
static uint _total_peeks;
|
||||
#endif
|
||||
|
||||
bool peek_in_queue_set();
|
||||
protected:
|
||||
virtual void yield();
|
||||
|
@ -462,6 +470,12 @@ public:
|
|||
// the terminator is finished.
|
||||
void reset_for_reuse();
|
||||
|
||||
#ifdef TRACESPINNING
|
||||
static uint total_yields() { return _total_yields; }
|
||||
static uint total_spins() { return _total_spins; }
|
||||
static uint total_peeks() { return _total_peeks; }
|
||||
static void print_termination_counts();
|
||||
#endif
|
||||
};
|
||||
|
||||
#define SIMPLE_STACK 0
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue