src/share/vm/gc_implementation/g1/concurrentG1RefineThread.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File 8047290final Sdiff src/share/vm/gc_implementation/g1

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

Print this page


   1 /*
   2  * Copyright (c) 2001, 2010, 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  *


  35 ConcurrentG1RefineThread(ConcurrentG1Refine* cg1r, ConcurrentG1RefineThread *next,
  36                          CardTableEntryClosure* refine_closure,
  37                          uint worker_id_offset, uint worker_id) :
  38   ConcurrentGCThread(),
  39   _refine_closure(refine_closure),
  40   _worker_id_offset(worker_id_offset),
  41   _worker_id(worker_id),
  42   _active(false),
  43   _next(next),
  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   } else {
  57     _monitor = DirtyCardQ_CBL_mon;
  58   }
  59   initialize();
  60   create_and_start();
  61 
  62   // set name
  63   set_name("G1 Concurrent Refinement Thread#%d", worker_id);
  64 }
  65 
  66 void ConcurrentG1RefineThread::initialize() {
  67   if (_worker_id < cg1r()->worker_thread_num()) {
  68     // Current thread activation threshold
  69     _threshold = MIN2<int>(cg1r()->thread_threshold_step() * (_worker_id + 1) + cg1r()->green_zone(),
  70                            cg1r()->yellow_zone());
  71     // A thread deactivates once the number of buffer reached a deactivation threshold
  72     _deactivation_threshold = MAX2<int>(_threshold - cg1r()->thread_threshold_step(), cg1r()->green_zone());
  73   } else {
  74     set_active(true);
  75   }


   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  *


  35 ConcurrentG1RefineThread(ConcurrentG1Refine* cg1r, ConcurrentG1RefineThread *next,
  36                          CardTableEntryClosure* refine_closure,
  37                          uint worker_id_offset, uint worker_id) :
  38   ConcurrentGCThread(),
  39   _refine_closure(refine_closure),
  40   _worker_id_offset(worker_id_offset),
  41   _worker_id(worker_id),
  42   _active(false),
  43   _next(next),
  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   }


src/share/vm/gc_implementation/g1/concurrentG1RefineThread.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File