annotate src/share/vm/gc_implementation/g1/concurrentG1Refine.hpp @ 4643:194f52aa2f23

7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap Summary: Refactor G1's hot card cache and card counts table into their own files. Simplify the card counts table, including removing the encoding of the card index in each entry. The card counts table now has a 1:1 correspondence with the cards spanned by heap. Space for the card counts table is reserved from virtual memory (rather than C heap) during JVM startup and is committed/expanded when the heap is expanded. Changes were also reviewed-by Vitaly Davidovich. Reviewed-by: tschatzl, jmasa
author johnc
date Thu, 09 May 2013 11:16:39 -0700
parents b9a9ed0f8eeb
children e72f7eecc96d
rev   line source
ysr@342 1 /*
johnc@4643 2 * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
ysr@342 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
ysr@342 4 *
ysr@342 5 * This code is free software; you can redistribute it and/or modify it
ysr@342 6 * under the terms of the GNU General Public License version 2 only, as
ysr@342 7 * published by the Free Software Foundation.
ysr@342 8 *
ysr@342 9 * This code is distributed in the hope that it will be useful, but WITHOUT
ysr@342 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
ysr@342 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
ysr@342 12 * version 2 for more details (a copy is included in the LICENSE file that
ysr@342 13 * accompanied this code).
ysr@342 14 *
ysr@342 15 * You should have received a copy of the GNU General Public License version
ysr@342 16 * 2 along with this work; if not, write to the Free Software Foundation,
ysr@342 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
ysr@342 18 *
trims@1472 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
trims@1472 20 * or visit www.oracle.com if you need additional information or have any
trims@1472 21 * questions.
ysr@342 22 *
ysr@342 23 */
ysr@342 24
stefank@1879 25 #ifndef SHARE_VM_GC_IMPLEMENTATION_G1_CONCURRENTG1REFINE_HPP
stefank@1879 26 #define SHARE_VM_GC_IMPLEMENTATION_G1_CONCURRENTG1REFINE_HPP
stefank@1879 27
johnc@4643 28 #include "gc_implementation/g1/g1HotCardCache.hpp"
stefank@1879 29 #include "memory/allocation.hpp"
stefank@1879 30 #include "runtime/thread.hpp"
stefank@1879 31 #include "utilities/globalDefinitions.hpp"
stefank@1879 32
ysr@342 33 // Forward decl
ysr@342 34 class ConcurrentG1RefineThread;
johnc@4643 35 class G1CollectedHeap;
johnc@4643 36 class G1HotCardCache;
ysr@342 37 class G1RemSet;
ysr@342 38
zgu@3465 39 class ConcurrentG1Refine: public CHeapObj<mtGC> {
iveresov@794 40 ConcurrentG1RefineThread** _threads;
iveresov@794 41 int _n_threads;
iveresov@1111 42 int _n_worker_threads;
iveresov@1111 43 /*
iveresov@1111 44 * The value of the update buffer queue length falls into one of 3 zones:
iveresov@1111 45 * green, yellow, red. If the value is in [0, green) nothing is
iveresov@1111 46 * done, the buffers are left unprocessed to enable the caching effect of the
iveresov@1111 47 * dirtied cards. In the yellow zone [green, yellow) the concurrent refinement
iveresov@1111 48 * threads are gradually activated. In [yellow, red) all threads are
iveresov@1111 49 * running. If the length becomes red (max queue length) the mutators start
iveresov@1111 50 * processing the buffers.
iveresov@1111 51 *
tonyp@1282 52 * There are some interesting cases (when G1UseAdaptiveConcRefinement
tonyp@1282 53 * is turned off):
iveresov@1111 54 * 1) green = yellow = red = 0. In this case the mutator will process all
iveresov@1111 55 * buffers. Except for those that are created by the deferred updates
iveresov@1111 56 * machinery during a collection.
iveresov@1111 57 * 2) green = 0. Means no caching. Can be a good way to minimize the
iveresov@1111 58 * amount of time spent updating rsets during a collection.
iveresov@1111 59 */
iveresov@1111 60 int _green_zone;
iveresov@1111 61 int _yellow_zone;
iveresov@1111 62 int _red_zone;
iveresov@1111 63
iveresov@1111 64 int _thread_threshold_step;
iveresov@1111 65
johnc@4643 66 // We delay the refinement of 'hot' cards using the hot card cache.
johnc@4643 67 G1HotCardCache _hot_card_cache;
johnc@4643 68
iveresov@1111 69 // Reset the threshold step value based of the current zone boundaries.
iveresov@1111 70 void reset_threshold_step();
johnc@890 71
ysr@342 72 public:
johnc@4643 73 ConcurrentG1Refine(G1CollectedHeap* g1h);
ysr@342 74 ~ConcurrentG1Refine();
ysr@342 75
ysr@342 76 void init(); // Accomplish some initialization that has to wait.
iveresov@794 77 void stop();
ysr@342 78
iveresov@1111 79 void reinitialize_threads();
iveresov@1111 80
iveresov@794 81 // Iterate over the conc refine threads
iveresov@794 82 void threads_do(ThreadClosure *tc);
ysr@342 83
iveresov@1111 84 static int thread_num();
tonyp@1019 85
tonyp@1019 86 void print_worker_threads_on(outputStream* st) const;
iveresov@1111 87
iveresov@1111 88 void set_green_zone(int x) { _green_zone = x; }
iveresov@1111 89 void set_yellow_zone(int x) { _yellow_zone = x; }
iveresov@1111 90 void set_red_zone(int x) { _red_zone = x; }
iveresov@1111 91
iveresov@1111 92 int green_zone() const { return _green_zone; }
iveresov@1111 93 int yellow_zone() const { return _yellow_zone; }
iveresov@1111 94 int red_zone() const { return _red_zone; }
iveresov@1111 95
iveresov@1111 96 int total_thread_num() const { return _n_threads; }
iveresov@1111 97 int worker_thread_num() const { return _n_worker_threads; }
iveresov@1111 98
iveresov@1111 99 int thread_threshold_step() const { return _thread_threshold_step; }
johnc@4643 100
johnc@4643 101 G1HotCardCache* hot_card_cache() { return &_hot_card_cache; }
ysr@342 102 };
stefank@1879 103
stefank@1879 104 #endif // SHARE_VM_GC_IMPLEMENTATION_G1_CONCURRENTG1REFINE_HPP