src/hotspot/share/gc/parallel/mutableNUMASpace.hpp
author coleenp
Thu, 10 Jan 2019 15:13:51 -0500
changeset 53244 9807daeb47c4
parent 51332 c25572739e7c
permissions -rw-r--r--
8216167: Update include guards to reflect correct directories Summary: Use script and some manual fixup to fix directores names in include guards. Reviewed-by: lfoltan, eosterlund, kbarrett
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     1
/*
53244
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 51332
diff changeset
     2
 * Copyright (c) 2006, 2019, Oracle and/or its affiliates. All rights reserved.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     4
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
489c9b5090e2 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
489c9b5090e2 Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     8
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
489c9b5090e2 Initial load
duke
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
489c9b5090e2 Initial load
duke
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
489c9b5090e2 Initial load
duke
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
489c9b5090e2 Initial load
duke
parents:
diff changeset
    13
 * accompanied this code).
489c9b5090e2 Initial load
duke
parents:
diff changeset
    14
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
489c9b5090e2 Initial load
duke
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    18
 *
5547
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 2105
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 2105
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 2105
diff changeset
    21
 * questions.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    22
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    23
 */
489c9b5090e2 Initial load
duke
parents:
diff changeset
    24
53244
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 51332
diff changeset
    25
#ifndef SHARE_GC_PARALLEL_MUTABLENUMASPACE_HPP
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 51332
diff changeset
    26
#define SHARE_GC_PARALLEL_MUTABLENUMASPACE_HPP
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    27
30764
fec48bf5a827 8079792: GC directory structure cleanup
pliden
parents: 22552
diff changeset
    28
#include "gc/parallel/mutableSpace.hpp"
fec48bf5a827 8079792: GC directory structure cleanup
pliden
parents: 22552
diff changeset
    29
#include "gc/shared/gcUtil.hpp"
15482
470d0b0c09f1 8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents: 13195
diff changeset
    30
#include "utilities/macros.hpp"
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    31
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    32
/*
489c9b5090e2 Initial load
duke
parents:
diff changeset
    33
 *    The NUMA-aware allocator (MutableNUMASpace) is basically a modification
489c9b5090e2 Initial load
duke
parents:
diff changeset
    34
 * of MutableSpace which preserves interfaces but implements different
489c9b5090e2 Initial load
duke
parents:
diff changeset
    35
 * functionality. The space is split into chunks for each locality group
489c9b5090e2 Initial load
duke
parents:
diff changeset
    36
 * (resizing for adaptive size policy is also supported). For each thread
489c9b5090e2 Initial load
duke
parents:
diff changeset
    37
 * allocations are performed in the chunk corresponding to the home locality
489c9b5090e2 Initial load
duke
parents:
diff changeset
    38
 * group of the thread. Whenever any chunk fills-in the young generation
489c9b5090e2 Initial load
duke
parents:
diff changeset
    39
 * collection occurs.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    40
 *   The chunks can be also be adaptively resized. The idea behind the adaptive
489c9b5090e2 Initial load
duke
parents:
diff changeset
    41
 * sizing is to reduce the loss of the space in the eden due to fragmentation.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    42
 * The main cause of fragmentation is uneven allocation rates of threads.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    43
 * The allocation rate difference between locality groups may be caused either by
489c9b5090e2 Initial load
duke
parents:
diff changeset
    44
 * application specifics or by uneven LWP distribution by the OS. Besides,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    45
 * application can have less threads then the number of locality groups.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    46
 * In order to resize the chunk we measure the allocation rate of the
489c9b5090e2 Initial load
duke
parents:
diff changeset
    47
 * application between collections. After that we reshape the chunks to reflect
489c9b5090e2 Initial load
duke
parents:
diff changeset
    48
 * the allocation rate pattern. The AdaptiveWeightedAverage exponentially
489c9b5090e2 Initial load
duke
parents:
diff changeset
    49
 * decaying average is used to smooth the measurements. The NUMASpaceResizeRate
489c9b5090e2 Initial load
duke
parents:
diff changeset
    50
 * parameter is used to control the adaptation speed by restricting the number of
489c9b5090e2 Initial load
duke
parents:
diff changeset
    51
 * bytes that can be moved during the adaptation phase.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    52
 *   Chunks may contain pages from a wrong locality group. The page-scanner has
489c9b5090e2 Initial load
duke
parents:
diff changeset
    53
 * been introduced to address the problem. Remote pages typically appear due to
489c9b5090e2 Initial load
duke
parents:
diff changeset
    54
 * the memory shortage in the target locality group. Besides Solaris would
489c9b5090e2 Initial load
duke
parents:
diff changeset
    55
 * allocate a large page from the remote locality group even if there are small
489c9b5090e2 Initial load
duke
parents:
diff changeset
    56
 * local pages available. The page-scanner scans the pages right after the
489c9b5090e2 Initial load
duke
parents:
diff changeset
    57
 * collection and frees remote pages in hope that subsequent reallocation would
489c9b5090e2 Initial load
duke
parents:
diff changeset
    58
 * be more successful. This approach proved to be useful on systems with high
489c9b5090e2 Initial load
duke
parents:
diff changeset
    59
 * load where multiple processes are competing for the memory.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    60
 */
489c9b5090e2 Initial load
duke
parents:
diff changeset
    61
489c9b5090e2 Initial load
duke
parents:
diff changeset
    62
class MutableNUMASpace : public MutableSpace {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    63
  friend class VMStructs;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    64
13195
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents: 12379
diff changeset
    65
  class LGRPSpace : public CHeapObj<mtGC> {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    66
    int _lgrp_id;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    67
    MutableSpace* _space;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    68
    MemRegion _invalid_region;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    69
    AdaptiveWeightedAverage *_alloc_rate;
1405
ce6e6fe90107 6740923: NUMA allocator: Ensure the progress of adaptive chunk resizing
iveresov
parents: 977
diff changeset
    70
    bool _allocation_failed;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    71
489c9b5090e2 Initial load
duke
parents:
diff changeset
    72
    struct SpaceStats {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    73
      size_t _local_space, _remote_space, _unbiased_space, _uncommited_space;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    74
      size_t _large_pages, _small_pages;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    75
489c9b5090e2 Initial load
duke
parents:
diff changeset
    76
      SpaceStats() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    77
        _local_space = 0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    78
        _remote_space = 0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    79
        _unbiased_space = 0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    80
        _uncommited_space = 0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    81
        _large_pages = 0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    82
        _small_pages = 0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    83
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    84
    };
489c9b5090e2 Initial load
duke
parents:
diff changeset
    85
489c9b5090e2 Initial load
duke
parents:
diff changeset
    86
    SpaceStats _space_stats;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    87
489c9b5090e2 Initial load
duke
parents:
diff changeset
    88
    char* _last_page_scanned;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    89
    char* last_page_scanned()            { return _last_page_scanned; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    90
    void set_last_page_scanned(char* p)  { _last_page_scanned = p;    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    91
   public:
51332
c25572739e7c 8208669: GC changes to allow enabling -Wreorder
tschatzl
parents: 47216
diff changeset
    92
    LGRPSpace(int l, size_t alignment) : _lgrp_id(l), _allocation_failed(false), _last_page_scanned(NULL) {
1911
b7cfe7eb809c 6783381: NUMA allocator: don't pretouch eden space with UseNUMA
iveresov
parents: 1405
diff changeset
    93
      _space = new MutableSpace(alignment);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    94
      _alloc_rate = new AdaptiveWeightedAverage(NUMAChunkResizeWeight);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    95
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    96
    ~LGRPSpace() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    97
      delete _space;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    98
      delete _alloc_rate;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    99
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   100
489c9b5090e2 Initial load
duke
parents:
diff changeset
   101
    void add_invalid_region(MemRegion r) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   102
      if (!_invalid_region.is_empty()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   103
      _invalid_region.set_start(MIN2(_invalid_region.start(), r.start()));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   104
      _invalid_region.set_end(MAX2(_invalid_region.end(), r.end()));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   105
      } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   106
      _invalid_region = r;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   107
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   108
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   109
489c9b5090e2 Initial load
duke
parents:
diff changeset
   110
    static bool equals(void* lgrp_id_value, LGRPSpace* p) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   111
      return *(int*)lgrp_id_value == p->lgrp_id();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   112
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   113
1405
ce6e6fe90107 6740923: NUMA allocator: Ensure the progress of adaptive chunk resizing
iveresov
parents: 977
diff changeset
   114
    // Report a failed allocation.
ce6e6fe90107 6740923: NUMA allocator: Ensure the progress of adaptive chunk resizing
iveresov
parents: 977
diff changeset
   115
    void set_allocation_failed() { _allocation_failed = true;  }
ce6e6fe90107 6740923: NUMA allocator: Ensure the progress of adaptive chunk resizing
iveresov
parents: 977
diff changeset
   116
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   117
    void sample() {
1405
ce6e6fe90107 6740923: NUMA allocator: Ensure the progress of adaptive chunk resizing
iveresov
parents: 977
diff changeset
   118
      // If there was a failed allocation make allocation rate equal
ce6e6fe90107 6740923: NUMA allocator: Ensure the progress of adaptive chunk resizing
iveresov
parents: 977
diff changeset
   119
      // to the size of the whole chunk. This ensures the progress of
ce6e6fe90107 6740923: NUMA allocator: Ensure the progress of adaptive chunk resizing
iveresov
parents: 977
diff changeset
   120
      // the adaptation process.
ce6e6fe90107 6740923: NUMA allocator: Ensure the progress of adaptive chunk resizing
iveresov
parents: 977
diff changeset
   121
      size_t alloc_rate_sample;
ce6e6fe90107 6740923: NUMA allocator: Ensure the progress of adaptive chunk resizing
iveresov
parents: 977
diff changeset
   122
      if (_allocation_failed) {
ce6e6fe90107 6740923: NUMA allocator: Ensure the progress of adaptive chunk resizing
iveresov
parents: 977
diff changeset
   123
        alloc_rate_sample = space()->capacity_in_bytes();
ce6e6fe90107 6740923: NUMA allocator: Ensure the progress of adaptive chunk resizing
iveresov
parents: 977
diff changeset
   124
        _allocation_failed = false;
ce6e6fe90107 6740923: NUMA allocator: Ensure the progress of adaptive chunk resizing
iveresov
parents: 977
diff changeset
   125
      } else {
ce6e6fe90107 6740923: NUMA allocator: Ensure the progress of adaptive chunk resizing
iveresov
parents: 977
diff changeset
   126
        alloc_rate_sample = space()->used_in_bytes();
ce6e6fe90107 6740923: NUMA allocator: Ensure the progress of adaptive chunk resizing
iveresov
parents: 977
diff changeset
   127
      }
ce6e6fe90107 6740923: NUMA allocator: Ensure the progress of adaptive chunk resizing
iveresov
parents: 977
diff changeset
   128
      alloc_rate()->sample(alloc_rate_sample);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   129
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   130
489c9b5090e2 Initial load
duke
parents:
diff changeset
   131
    MemRegion invalid_region() const                { return _invalid_region;      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   132
    void set_invalid_region(MemRegion r)            { _invalid_region = r;         }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   133
    int lgrp_id() const                             { return _lgrp_id;             }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   134
    MutableSpace* space() const                     { return _space;               }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   135
    AdaptiveWeightedAverage* alloc_rate() const     { return _alloc_rate;          }
976
241230d48896 6723228: NUMA allocator: assert(lgrp_id != -1, "No lgrp_id set")
iveresov
parents: 971
diff changeset
   136
    void clear_alloc_rate()                         { _alloc_rate->clear();        }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   137
    SpaceStats* space_stats()                       { return &_space_stats;        }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   138
    void clear_space_stats()                        { _space_stats = SpaceStats(); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   139
489c9b5090e2 Initial load
duke
parents:
diff changeset
   140
    void accumulate_statistics(size_t page_size);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   141
    void scan_pages(size_t page_size, size_t page_count);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   142
  };
489c9b5090e2 Initial load
duke
parents:
diff changeset
   143
489c9b5090e2 Initial load
duke
parents:
diff changeset
   144
  GrowableArray<LGRPSpace*>* _lgrp_spaces;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   145
  size_t _page_size;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   146
  unsigned _adaptation_cycles, _samples_count;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   147
46312
385a8b027e7d 8023905: Failing to initialize VM with small initial heap when NUMA and large pages are enabled
sangheki
parents: 30764
diff changeset
   148
  bool _must_use_large_pages;
385a8b027e7d 8023905: Failing to initialize VM with small initial heap when NUMA and large pages are enabled
sangheki
parents: 30764
diff changeset
   149
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   150
  void set_page_size(size_t psz)                     { _page_size = psz;          }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   151
  size_t page_size() const                           { return _page_size;         }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   152
489c9b5090e2 Initial load
duke
parents:
diff changeset
   153
  unsigned adaptation_cycles()                       { return _adaptation_cycles; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   154
  void set_adaptation_cycles(int v)                  { _adaptation_cycles = v;    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   155
489c9b5090e2 Initial load
duke
parents:
diff changeset
   156
  unsigned samples_count()                           { return _samples_count;     }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   157
  void increment_samples_count()                     { ++_samples_count;          }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   158
489c9b5090e2 Initial load
duke
parents:
diff changeset
   159
  size_t _base_space_size;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   160
  void set_base_space_size(size_t v)                 { _base_space_size = v;      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   161
  size_t base_space_size() const                     { return _base_space_size;   }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   162
489c9b5090e2 Initial load
duke
parents:
diff changeset
   163
  // Check if the NUMA topology has changed. Add and remove spaces if needed.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   164
  // The update can be forced by setting the force parameter equal to true.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   165
  bool update_layout(bool force);
388
bcc631c5bbec 6684395: Port NUMA-aware allocator to linux
iveresov
parents: 1
diff changeset
   166
  // Bias region towards the lgrp.
bcc631c5bbec 6684395: Port NUMA-aware allocator to linux
iveresov
parents: 1
diff changeset
   167
  void bias_region(MemRegion mr, int lgrp_id);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   168
  // Free pages in a given region.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   169
  void free_region(MemRegion mr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   170
  // Get current chunk size.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   171
  size_t current_chunk_size(int i);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   172
  // Get default chunk size (equally divide the space).
489c9b5090e2 Initial load
duke
parents:
diff changeset
   173
  size_t default_chunk_size();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   174
  // Adapt the chunk size to follow the allocation rate.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   175
  size_t adaptive_chunk_size(int i, size_t limit);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   176
  // Scan and free invalid pages.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   177
  void scan_pages(size_t page_count);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   178
  // Return the bottom_region and the top_region. Align them to page_size() boundary.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   179
  // |------------------new_region---------------------------------|
489c9b5090e2 Initial load
duke
parents:
diff changeset
   180
  // |----bottom_region--|---intersection---|------top_region------|
489c9b5090e2 Initial load
duke
parents:
diff changeset
   181
  void select_tails(MemRegion new_region, MemRegion intersection,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   182
                    MemRegion* bottom_region, MemRegion *top_region);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   183
  // Try to merge the invalid region with the bottom or top region by decreasing
489c9b5090e2 Initial load
duke
parents:
diff changeset
   184
  // the intersection area. Return the invalid_region aligned to the page_size()
489c9b5090e2 Initial load
duke
parents:
diff changeset
   185
  // boundary if it's inside the intersection. Return non-empty invalid_region
489c9b5090e2 Initial load
duke
parents:
diff changeset
   186
  // if it lies inside the intersection (also page-aligned).
489c9b5090e2 Initial load
duke
parents:
diff changeset
   187
  // |------------------new_region---------------------------------|
489c9b5090e2 Initial load
duke
parents:
diff changeset
   188
  // |----------------|-------invalid---|--------------------------|
489c9b5090e2 Initial load
duke
parents:
diff changeset
   189
  // |----bottom_region--|---intersection---|------top_region------|
489c9b5090e2 Initial load
duke
parents:
diff changeset
   190
  void merge_regions(MemRegion new_region, MemRegion* intersection,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   191
                     MemRegion *invalid_region);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   192
489c9b5090e2 Initial load
duke
parents:
diff changeset
   193
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   194
  GrowableArray<LGRPSpace*>* lgrp_spaces() const     { return _lgrp_spaces;       }
1911
b7cfe7eb809c 6783381: NUMA allocator: don't pretouch eden space with UseNUMA
iveresov
parents: 1405
diff changeset
   195
  MutableNUMASpace(size_t alignment);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   196
  virtual ~MutableNUMASpace();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   197
  // Space initialization.
1911
b7cfe7eb809c 6783381: NUMA allocator: don't pretouch eden space with UseNUMA
iveresov
parents: 1405
diff changeset
   198
  virtual void initialize(MemRegion mr, bool clear_space, bool mangle_space, bool setup_pages = SetupPages);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   199
  // Update space layout if necessary. Do all adaptive resizing job.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   200
  virtual void update();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   201
  // Update allocation rate averages.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   202
  virtual void accumulate_statistics();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   203
971
f0b20be4165d 6672698: mangle_unused_area() should not remangle the entire heap at each collection.
jmasa
parents: 616
diff changeset
   204
  virtual void clear(bool mangle_space);
f0b20be4165d 6672698: mangle_unused_area() should not remangle the entire heap at each collection.
jmasa
parents: 616
diff changeset
   205
  virtual void mangle_unused_area() PRODUCT_RETURN;
f0b20be4165d 6672698: mangle_unused_area() should not remangle the entire heap at each collection.
jmasa
parents: 616
diff changeset
   206
  virtual void mangle_unused_area_complete() PRODUCT_RETURN;
f0b20be4165d 6672698: mangle_unused_area() should not remangle the entire heap at each collection.
jmasa
parents: 616
diff changeset
   207
  virtual void mangle_region(MemRegion mr) PRODUCT_RETURN;
f0b20be4165d 6672698: mangle_unused_area() should not remangle the entire heap at each collection.
jmasa
parents: 616
diff changeset
   208
  virtual void check_mangled_unused_area(HeapWord* limit) PRODUCT_RETURN;
f0b20be4165d 6672698: mangle_unused_area() should not remangle the entire heap at each collection.
jmasa
parents: 616
diff changeset
   209
  virtual void check_mangled_unused_area_complete() PRODUCT_RETURN;
f0b20be4165d 6672698: mangle_unused_area() should not remangle the entire heap at each collection.
jmasa
parents: 616
diff changeset
   210
  virtual void set_top_for_allocations(HeapWord* v) PRODUCT_RETURN;
f0b20be4165d 6672698: mangle_unused_area() should not remangle the entire heap at each collection.
jmasa
parents: 616
diff changeset
   211
  virtual void set_top_for_allocations() PRODUCT_RETURN;
f0b20be4165d 6672698: mangle_unused_area() should not remangle the entire heap at each collection.
jmasa
parents: 616
diff changeset
   212
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   213
  virtual void ensure_parsability();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   214
  virtual size_t used_in_words() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   215
  virtual size_t free_in_words() const;
1405
ce6e6fe90107 6740923: NUMA allocator: Ensure the progress of adaptive chunk resizing
iveresov
parents: 977
diff changeset
   216
ce6e6fe90107 6740923: NUMA allocator: Ensure the progress of adaptive chunk resizing
iveresov
parents: 977
diff changeset
   217
  using MutableSpace::capacity_in_words;
ce6e6fe90107 6740923: NUMA allocator: Ensure the progress of adaptive chunk resizing
iveresov
parents: 977
diff changeset
   218
  virtual size_t capacity_in_words(Thread* thr) const;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   219
  virtual size_t tlab_capacity(Thread* thr) const;
22552
a29022212180 8030177: G1: Enable TLAB resizing
brutisso
parents: 22234
diff changeset
   220
  virtual size_t tlab_used(Thread* thr) const;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   221
  virtual size_t unsafe_max_tlab_alloc(Thread* thr) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   222
489c9b5090e2 Initial load
duke
parents:
diff changeset
   223
  // Allocation (return NULL if full)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   224
  virtual HeapWord* allocate(size_t word_size);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   225
  virtual HeapWord* cas_allocate(size_t word_size);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   226
489c9b5090e2 Initial load
duke
parents:
diff changeset
   227
  // Debugging
489c9b5090e2 Initial load
duke
parents:
diff changeset
   228
  virtual void print_on(outputStream* st) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   229
  virtual void print_short_on(outputStream* st) const;
12379
2cf45b79ce3a 4988100: oop_verify_old_oop appears to be dead
brutisso
parents: 7397
diff changeset
   230
  virtual void verify();
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   231
489c9b5090e2 Initial load
duke
parents:
diff changeset
   232
  virtual void set_top(HeapWord* value);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   233
};
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
   234
53244
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 51332
diff changeset
   235
#endif // SHARE_GC_PARALLEL_MUTABLENUMASPACE_HPP