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