src/share/vm/gc_implementation/concurrentMarkSweep/freeBlockDictionary.hpp

Wed, 23 Dec 2009 09:23:54 -0800

author
ysr
date
Wed, 23 Dec 2009 09:23:54 -0800
changeset 1580
e018e6884bd8
parent 704
850fdf70db2b
child 1907
c18cbe5936b8
permissions
-rw-r--r--

6631166: CMS: better heuristics when combatting fragmentation
Summary: Autonomic per-worker free block cache sizing, tunable coalition policies, fixes to per-size block statistics, retuned gain and bandwidth of some feedback loop filters to allow quicker reactivity to abrupt changes in ambient demand, and other heuristics to reduce fragmentation of the CMS old gen. Also tightened some assertions, including those related to locking.
Reviewed-by: jmasa

duke@435 1 /*
xdono@631 2 * Copyright 2001-2008 Sun Microsystems, Inc. All Rights Reserved.
duke@435 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
duke@435 4 *
duke@435 5 * This code is free software; you can redistribute it and/or modify it
duke@435 6 * under the terms of the GNU General Public License version 2 only, as
duke@435 7 * published by the Free Software Foundation.
duke@435 8 *
duke@435 9 * This code is distributed in the hope that it will be useful, but WITHOUT
duke@435 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
duke@435 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
duke@435 12 * version 2 for more details (a copy is included in the LICENSE file that
duke@435 13 * accompanied this code).
duke@435 14 *
duke@435 15 * You should have received a copy of the GNU General Public License version
duke@435 16 * 2 along with this work; if not, write to the Free Software Foundation,
duke@435 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
duke@435 18 *
duke@435 19 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
duke@435 20 * CA 95054 USA or visit www.sun.com if you need additional information or
duke@435 21 * have any questions.
duke@435 22 *
duke@435 23 */
duke@435 24
duke@435 25 // A FreeBlockDictionary is an abstract superclass that will allow
duke@435 26 // a number of alternative implementations in the future.
duke@435 27 class FreeBlockDictionary: public CHeapObj {
duke@435 28 public:
duke@435 29 enum Dither {
duke@435 30 atLeast,
duke@435 31 exactly,
duke@435 32 roughly
duke@435 33 };
duke@435 34 enum DictionaryChoice {
duke@435 35 dictionaryBinaryTree = 0,
duke@435 36 dictionarySplayTree = 1,
duke@435 37 dictionarySkipList = 2
duke@435 38 };
duke@435 39
duke@435 40 private:
duke@435 41 NOT_PRODUCT(Mutex* _lock;)
duke@435 42
duke@435 43 public:
duke@435 44 virtual void removeChunk(FreeChunk* fc) = 0;
duke@435 45 virtual FreeChunk* getChunk(size_t size, Dither dither = atLeast) = 0;
duke@435 46 virtual void returnChunk(FreeChunk* chunk) = 0;
duke@435 47 virtual size_t totalChunkSize(debug_only(const Mutex* lock)) const = 0;
duke@435 48 virtual size_t maxChunkSize() const = 0;
duke@435 49 virtual size_t minSize() const = 0;
duke@435 50 // Reset the dictionary to the initial conditions for a single
duke@435 51 // block.
duke@435 52 virtual void reset(HeapWord* addr, size_t size) = 0;
duke@435 53 virtual void reset() = 0;
duke@435 54
duke@435 55 virtual void dictCensusUpdate(size_t size, bool split, bool birth) = 0;
duke@435 56 virtual bool coalDictOverPopulated(size_t size) = 0;
duke@435 57 virtual void beginSweepDictCensus(double coalSurplusPercent,
ysr@1580 58 float inter_sweep_current, float inter_sweep_estimate,
ysr@1580 59 float intra__sweep_current) = 0;
duke@435 60 virtual void endSweepDictCensus(double splitSurplusPercent) = 0;
duke@435 61 virtual FreeChunk* findLargestDict() const = 0;
duke@435 62 // verify that the given chunk is in the dictionary.
duke@435 63 virtual bool verifyChunkInFreeLists(FreeChunk* tc) const = 0;
duke@435 64
duke@435 65 // Sigma_{all_free_blocks} (block_size^2)
duke@435 66 virtual double sum_of_squared_block_sizes() const = 0;
duke@435 67
duke@435 68 virtual FreeChunk* find_chunk_ends_at(HeapWord* target) const = 0;
duke@435 69 virtual void inc_totalSize(size_t v) = 0;
duke@435 70 virtual void dec_totalSize(size_t v) = 0;
duke@435 71
duke@435 72 NOT_PRODUCT (
duke@435 73 virtual size_t sumDictReturnedBytes() = 0;
duke@435 74 virtual void initializeDictReturnedBytes() = 0;
duke@435 75 virtual size_t totalCount() = 0;
duke@435 76 )
duke@435 77
duke@435 78 virtual void reportStatistics() const {
duke@435 79 gclog_or_tty->print("No statistics available");
duke@435 80 }
duke@435 81
duke@435 82 virtual void printDictCensus() const = 0;
ysr@1580 83 virtual void print_free_lists(outputStream* st) const = 0;
duke@435 84
duke@435 85 virtual void verify() const = 0;
duke@435 86
duke@435 87 Mutex* par_lock() const PRODUCT_RETURN0;
duke@435 88 void set_par_lock(Mutex* lock) PRODUCT_RETURN;
duke@435 89 void verify_par_locked() const PRODUCT_RETURN;
duke@435 90 };

mercurial