g1CollectorPolicy.hpp revision 4362
0N/A * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved. 0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 0N/A * This code is free software; you can redistribute it and/or modify it 0N/A * under the terms of the GNU General Public License version 2 only, as 0N/A * published by the Free Software Foundation. 0N/A * This code is distributed in the hope that it will be useful, but WITHOUT 0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 0N/A * version 2 for more details (a copy is included in the LICENSE file that 0N/A * accompanied this code). 0N/A * You should have received a copy of the GNU General Public License version 0N/A * 2 along with this work; if not, write to the Free Software Foundation, 0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 0N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 0N/A// A G1CollectorPolicy makes policy decisions that determine the 0N/A// characteristics of the collector. Examples include: 0N/A// * choice of collection set. 0N/A// * when to collect. 0N/A// TraceGen0Time collects data on _both_ young and mixed evacuation pauses 0N/A// (the latter may contain non-young regions - i.e. regions that are 0N/A// technically in Gen1) while TraceGen1Time collects data about full GCs. // There are three command line options related to the young gen size: // NewSize, MaxNewSize and NewRatio (There is also -Xmn, but that is // just a short form for NewSize==MaxNewSize). G1 will use its internal // heuristics to calculate the actual young gen size, so these options // basically only limit the range within which G1 can pick a young gen // size. Also, these are general options taking byte sizes. G1 will // internally work with a number of regions instead. So, some rounding // If nothing related to the the young gen size is set on the command // line we should allow the young gen to be between G1NewSizePercent // and G1MaxNewSizePercent of the heap size. This means that every time // the heap size changes, the limits for the young gen size will be // If only -XX:NewSize is set we should use the specified value as the // minimum size for young gen. Still using G1MaxNewSizePercent of the // If only -XX:MaxNewSize is set we should use the specified value as the // maximum size for young gen. Still using G1NewSizePercent of the heap // If -XX:NewSize and -XX:MaxNewSize are both specified we use these values. // No updates when the heap size changes. There is a special case when // NewSize==MaxNewSize. This is interpreted as "fixed" and will use a // different heuristic for calculating the collection set when we do mixed // If only -XX:NewRatio is set we should use the specified ratio of the heap // as both min and max. This will be interpreted as "fixed" just like the // NewSize==MaxNewSize case above. But we will update the min and max // everytime the heap size changes. // NewSize and MaxNewSize override NewRatio. So, NewRatio is ignored if it is // combined with either NewSize or MaxNewSize. (A warning message is printed.) // either equal to the number of parallel threads, if ParallelGCThreads // has been set, or 1 otherwise // The number of GC threads currently active. // These exclude marking times. // indicates whether we are in young or mixed GC mode // The max number of regions we can extend the eden by while the GC // locker is active. This should be >= _young_list_target_length; // add here any more surv rate groups // A function that prevents us putting too much stock in small sample // sets. Returns a number between 2.0 and 1.0, depending on the number // of samples. 5 or more samples yields one; fewer scales linearly from // 2.0 at 1 sample to 1.0 at 5. // also call it on any more surv rate groups // Returns an estimate of the survival rate of the region at yg-age // Statistics kept per GC stoppage, pause or full. // Add a new GC of the given duration and end time to the record. // The head of the list (via "next_in_collection_set()") representing the // current collection set. Set from the incrementally built collection // set at the start of the pause. // The number of bytes in the collection set before the pause. Set from // the incrementally built collection set at the start of an evacuation // pause, and incremented in finalize_cset() when adding old regions // (if any) to the collection set. // The number of bytes copied during the GC. // The associated information that is maintained while the incremental // collection set is being built with young regions. Used to populate // the recorded info for the evacuation pause. Active,
// We are actively building the collection set Inactive // We are not actively building the collection set // The head of the incrementally built collection set. // The tail of the incrementally built collection set. // The number of bytes in the incrementally built collection set. // Used to set _collection_set_bytes_used_before at the start of // Used to record the highest end of heap region in collection set // The RSet lengths recorded for regions in the CSet. It is updated // by the thread that adds a new region to the CSet. We assume that // only one thread can be allocating a new CSet region (currently, // it does so after taking the Heap_lock) hence no need to // synchronize updates to this field. // A concurrent refinement thread periodcially samples the young // region RSets and needs to update _inc_cset_recorded_rs_lengths as // the RSets grow. Instead of having to syncronize updates to that // field we accumulate them in this field and add it to // _inc_cset_recorded_rs_lengths_diffs at the start of a GC. // The predicted elapsed time it will take to collect the regions in // the CSet. This is updated by the thread that adds a new region to // the CSet. See the comment for _inc_cset_recorded_rs_lengths about // MT-safety assumptions. // See the comment for _inc_cset_recorded_rs_lengths_diffs. // Stash a pointer to the g1 heap. // The ratio of gc time to elapsed time, computed over recent pauses. // At the end of a pause we check the heap occupancy and we decide // whether we will start a marking cycle during the next pause. If // we decide that we want to do that, we will set this parameter to // true. So, this parameter will stay true between the end of a // pause and the beginning of a subsequent pause (not necessarily // the next one, see the comments on the next field) when we decide // that we will indeed start a marking cycle and do the initial-mark // If initiate_conc_mark_if_possible() is set at the beginning of a // pause, it is a suggestion that the pause should start a marking // cycle by doing the initial-mark work. However, it is possible // that the concurrent marking thread is still finishing up the // previous marking cycle (e.g., clearing the next marking // bitmap). If that is the case we cannot start a new cycle and // we'll have to wait for the concurrent marking thread to finish // what it is doing. In this case we will postpone the marking cycle // initiation decision for the next pause. When we eventually decide // to start a cycle, we will set _during_initial_mark_pause which // will stay true until the end of the initial-mark pause and it's // the condition that indicates that a pause is doing the // This set of variables tracks the collector efficiency, in order to // determine whether we should initiate a new marking. // Update the young list target length either by setting it to the // desired fixed value or by calculating it using G1's pause // prediction model. If no rs_lengths parameter is passed, predict // the RS lengths using the prediction model, otherwise use the // given rs_lengths as the prediction. // Calculate and return the minimum desired young list target // length. This is the minimum desired young list length according // Calculate and return the maximum desired young list target // length. This is the maximum desired young list length according // Calculate and return the maximum young list target length that // can fit into the pause time goal. The parameters are: rs_lengths // represent the prediction of how large the young RSet lengths will // be, base_min_length is the alreay existing number of regions in // the young list, min_length and max_length are the desired min and // max young list length according to the user's inputs. // Check whether a given young length (young_length) fits into the // given target pause time and whether the prediction for the amount // of objects to be copied for the given length will fit into the // given free space (expressed by base_free_regions). It is used by // calculate_young_list_target_length(). // Check the current value of the young list RSet lengths and // compare it against the last prediction. If the current value is // higher, recalculate the young list target length prediction. // This should be called after the heap is resized. // Create jstat counters for the policy. // This method controls how a collector handles one or more // of its generations being fully allocated. // Update the heuristic info to record a collection pause of the given // start time, where the given number of bytes were used at the start. // This may involve changing the desired size of a collection set. // Must currently be called while the world is stopped. // Record the fact that a full collection occurred. // Record how much space we copied during a GC. This is typically // called when a GC alloc region is being retired. // The amount of space we copied during a GC. // Determine whether there are candidate regions so that the // next GC should be mixed. The two action strings are used // in the ergo output when the method returns true or false. // Choose a new collection set. Marks the chosen regions as being // "in_collection_set", and links them together. The head and number of // the collection set are available via access methods. // The head of the list (via "next_in_collection_set()") representing the // current collection set. // Add old region "hr" to the CSet. // Incremental CSet Support // The head of the incrementally built collection set. // The tail of the incrementally built collection set. // Initialize incremental collection set info. // Perform any final calculations on the incremental CSet fields // before we can use them. // Stop adding regions to the incremental collection set // Add information about hr to the aggregated information for the // incrementally built collection set. // Update information about hr in the aggregated information for // the incrementally built collection set. // Update the incremental cset information when adding a region // (should not be called directly). // Add hr to the LHS of the incremental collection set. // Add hr to the RHS of the incremental collection set. // This sets the initiate_conc_mark_if_possible() flag to start a // new cycle, as long as we are not already in one. It's best if it // is called during a safepoint when the test whether a cycle is in // progress or not is stable. // This is called at the very beginning of an evacuation pause (it // has to be the first thing that the pause does). If // initiate_conc_mark_if_possible() is true, and the concurrent // marking thread has completed its work during the previous cycle, // it will set during_initial_mark_pause() to so that the pause does // the initial-mark work and start a marking cycle. // If an expansion would be appropriate, because recent GC overhead had // exceeded the desired limit, return an amount to expand by. // Print tracing information. // Print stats on young survival ratio // do that for any other surv rate groups // Survivor regions policy. // Current tenuring threshold, set to 0 if the collector reaches the // maximum amount of suvivors regions. // The limit on the number of regions allocated for survivors. // For reporting purposes. // The amount of survor regions after a collection. // List of survivor regions. // The limit on regions for a particular purpose is reached. // Calculates survivor space parameters. // This should move to some place more general... // If we have "n" measurements, and we've kept track of their "sum" and the // "sum_of_squares" of the measurements, this returns the variance of the #
endif // SHARE_VM_GC_IMPLEMENTATION_G1_G1COLLECTORPOLICY_HPP