< prev index next >

src/share/vm/gc_implementation/g1/concurrentG1RefineThread.cpp

Print this page


   1 /*
   2  * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *


  44   _monitor(NULL),
  45   _cg1r(cg1r),
  46   _vtime_accum(0.0)
  47 {
  48 
  49   // Each thread has its own monitor. The i-th thread is responsible for signaling
  50   // to thread i+1 if the number of buffers in the queue exceeds a threshold for this
  51   // thread. Monitors are also used to wake up the threads during termination.
  52   // The 0th worker in notified by mutator threads and has a special monitor.
  53   // The last worker is used for young gen rset size sampling.
  54   if (worker_id > 0) {
  55     _monitor = new Monitor(Mutex::nonleaf, "Refinement monitor", true,
  56                            Monitor::_safepoint_check_never);
  57   } else {
  58     _monitor = DirtyCardQ_CBL_mon;
  59   }
  60   initialize();
  61   create_and_start();
  62 
  63   // set name
  64   set_name("G1 Concurrent Refinement Thread#%d", worker_id);
  65 }
  66 
  67 void ConcurrentG1RefineThread::initialize() {
  68   if (_worker_id < cg1r()->worker_thread_num()) {
  69     // Current thread activation threshold
  70     _threshold = MIN2<int>(cg1r()->thread_threshold_step() * (_worker_id + 1) + cg1r()->green_zone(),
  71                            cg1r()->yellow_zone());
  72     // A thread deactivates once the number of buffer reached a deactivation threshold
  73     _deactivation_threshold = MAX2<int>(_threshold - cg1r()->thread_threshold_step(), cg1r()->green_zone());
  74   } else {
  75     set_active(true);
  76   }
  77 }
  78 
  79 void ConcurrentG1RefineThread::sample_young_list_rs_lengths() {
  80   SuspendibleThreadSetJoiner sts;
  81   G1CollectedHeap* g1h = G1CollectedHeap::heap();
  82   G1CollectorPolicy* g1p = g1h->g1_policy();
  83   if (g1p->adaptive_young_list_length()) {
  84     int regions_visited = 0;


   1 /*
   2  * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *


  44   _monitor(NULL),
  45   _cg1r(cg1r),
  46   _vtime_accum(0.0)
  47 {
  48 
  49   // Each thread has its own monitor. The i-th thread is responsible for signaling
  50   // to thread i+1 if the number of buffers in the queue exceeds a threshold for this
  51   // thread. Monitors are also used to wake up the threads during termination.
  52   // The 0th worker in notified by mutator threads and has a special monitor.
  53   // The last worker is used for young gen rset size sampling.
  54   if (worker_id > 0) {
  55     _monitor = new Monitor(Mutex::nonleaf, "Refinement monitor", true,
  56                            Monitor::_safepoint_check_never);
  57   } else {
  58     _monitor = DirtyCardQ_CBL_mon;
  59   }
  60   initialize();
  61   create_and_start();
  62 
  63   // set name
  64   set_name("G1 ConRefine#%d", worker_id);
  65 }
  66 
  67 void ConcurrentG1RefineThread::initialize() {
  68   if (_worker_id < cg1r()->worker_thread_num()) {
  69     // Current thread activation threshold
  70     _threshold = MIN2<int>(cg1r()->thread_threshold_step() * (_worker_id + 1) + cg1r()->green_zone(),
  71                            cg1r()->yellow_zone());
  72     // A thread deactivates once the number of buffer reached a deactivation threshold
  73     _deactivation_threshold = MAX2<int>(_threshold - cg1r()->thread_threshold_step(), cg1r()->green_zone());
  74   } else {
  75     set_active(true);
  76   }
  77 }
  78 
  79 void ConcurrentG1RefineThread::sample_young_list_rs_lengths() {
  80   SuspendibleThreadSetJoiner sts;
  81   G1CollectedHeap* g1h = G1CollectedHeap::heap();
  82   G1CollectorPolicy* g1p = g1h->g1_policy();
  83   if (g1p->adaptive_young_list_length()) {
  84     int regions_visited = 0;


< prev index next >