1 /*
2 * Copyright (c) 2006, 2013, 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 *
23 */
24
25 #ifndef SHARE_VM_GC_IMPLEMENTATION_SHARED_MUTABLENUMASPACE_HPP
26 #define SHARE_VM_GC_IMPLEMENTATION_SHARED_MUTABLENUMASPACE_HPP
27
28 #include "utilities/macros.hpp"
29 #if INCLUDE_ALL_GCS
30 #include "gc_implementation/shared/gcUtil.hpp"
31 #include "gc_implementation/shared/mutableSpace.hpp"
32 #endif // INCLUDE_ALL_GCS
33
34 /*
35 * The NUMA-aware allocator (MutableNUMASpace) is basically a modification
36 * of MutableSpace which preserves interfaces but implements different
37 * functionality. The space is split into chunks for each locality group
38 * (resizing for adaptive size policy is also supported). For each thread
39 * allocations are performed in the chunk corresponding to the home locality
40 * group of the thread. Whenever any chunk fills-in the young generation
41 * collection occurs.
42 * The chunks can be also be adaptively resized. The idea behind the adaptive
43 * sizing is to reduce the loss of the space in the eden due to fragmentation.
44 * The main cause of fragmentation is uneven allocation rates of threads.
45 * The allocation rate difference between locality groups may be caused either by
46 * application specifics or by uneven LWP distribution by the OS. Besides,
47 * application can have less threads then the number of locality groups.
48 * In order to resize the chunk we measure the allocation rate of the
49 * application between collections. After that we reshape the chunks to reflect
50 * the allocation rate pattern. The AdaptiveWeightedAverage exponentially
51 * decaying average is used to smooth the measurements. The NUMASpaceResizeRate
52 * parameter is used to control the adaptation speed by restricting the number of
215 virtual size_t free_in_words() const;
216
217 using MutableSpace::capacity_in_words;
218 virtual size_t capacity_in_words(Thread* thr) const;
219 virtual size_t tlab_capacity(Thread* thr) const;
220 virtual size_t tlab_used(Thread* thr) const;
221 virtual size_t unsafe_max_tlab_alloc(Thread* thr) const;
222
223 // Allocation (return NULL if full)
224 virtual HeapWord* allocate(size_t word_size);
225 virtual HeapWord* cas_allocate(size_t word_size);
226
227 // Debugging
228 virtual void print_on(outputStream* st) const;
229 virtual void print_short_on(outputStream* st) const;
230 virtual void verify();
231
232 virtual void set_top(HeapWord* value);
233 };
234
235 #endif // SHARE_VM_GC_IMPLEMENTATION_SHARED_MUTABLENUMASPACE_HPP
|
1 /*
2 * Copyright (c) 2006, 2015, 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 *
23 */
24
25 #ifndef SHARE_VM_GC_PARALLEL_MUTABLENUMASPACE_HPP
26 #define SHARE_VM_GC_PARALLEL_MUTABLENUMASPACE_HPP
27
28 #include "gc/parallel/mutableSpace.hpp"
29 #include "gc/shared/gcUtil.hpp"
30 #include "utilities/macros.hpp"
31
32 /*
33 * The NUMA-aware allocator (MutableNUMASpace) is basically a modification
34 * of MutableSpace which preserves interfaces but implements different
35 * functionality. The space is split into chunks for each locality group
36 * (resizing for adaptive size policy is also supported). For each thread
37 * allocations are performed in the chunk corresponding to the home locality
38 * group of the thread. Whenever any chunk fills-in the young generation
39 * collection occurs.
40 * The chunks can be also be adaptively resized. The idea behind the adaptive
41 * sizing is to reduce the loss of the space in the eden due to fragmentation.
42 * The main cause of fragmentation is uneven allocation rates of threads.
43 * The allocation rate difference between locality groups may be caused either by
44 * application specifics or by uneven LWP distribution by the OS. Besides,
45 * application can have less threads then the number of locality groups.
46 * In order to resize the chunk we measure the allocation rate of the
47 * application between collections. After that we reshape the chunks to reflect
48 * the allocation rate pattern. The AdaptiveWeightedAverage exponentially
49 * decaying average is used to smooth the measurements. The NUMASpaceResizeRate
50 * parameter is used to control the adaptation speed by restricting the number of
213 virtual size_t free_in_words() const;
214
215 using MutableSpace::capacity_in_words;
216 virtual size_t capacity_in_words(Thread* thr) const;
217 virtual size_t tlab_capacity(Thread* thr) const;
218 virtual size_t tlab_used(Thread* thr) const;
219 virtual size_t unsafe_max_tlab_alloc(Thread* thr) const;
220
221 // Allocation (return NULL if full)
222 virtual HeapWord* allocate(size_t word_size);
223 virtual HeapWord* cas_allocate(size_t word_size);
224
225 // Debugging
226 virtual void print_on(outputStream* st) const;
227 virtual void print_short_on(outputStream* st) const;
228 virtual void verify();
229
230 virtual void set_top(HeapWord* value);
231 };
232
233 #endif // SHARE_VM_GC_PARALLEL_MUTABLENUMASPACE_HPP
|