Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_hotspot
提交
f6921aa8
D
dragonwell8_hotspot
项目概览
openanolis
/
dragonwell8_hotspot
通知
2
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
dragonwell8_hotspot
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
f6921aa8
编写于
10月 07, 2013
作者:
S
stefank
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8024547: MaxMetaspaceSize should limit the committed memory used by the metaspaces
Reviewed-by: brutisso, jmasa, coleenp
上级
e540de76
变更
9
展开全部
显示空白变更内容
内联
并排
Showing
9 changed file
with
511 addition
and
350 deletion
+511
-350
src/share/vm/gc_implementation/shared/vmGCOperations.hpp
src/share/vm/gc_implementation/shared/vmGCOperations.hpp
+0
-3
src/share/vm/gc_interface/collectedHeap.cpp
src/share/vm/gc_interface/collectedHeap.cpp
+0
-6
src/share/vm/gc_interface/collectedHeap.hpp
src/share/vm/gc_interface/collectedHeap.hpp
+0
-5
src/share/vm/memory/collectorPolicy.cpp
src/share/vm/memory/collectorPolicy.cpp
+0
-32
src/share/vm/memory/filemap.hpp
src/share/vm/memory/filemap.hpp
+1
-0
src/share/vm/memory/metaspace.cpp
src/share/vm/memory/metaspace.cpp
+468
-276
src/share/vm/memory/metaspace.hpp
src/share/vm/memory/metaspace.hpp
+35
-28
src/share/vm/runtime/arguments.cpp
src/share/vm/runtime/arguments.cpp
+3
-0
src/share/vm/runtime/globals.hpp
src/share/vm/runtime/globals.hpp
+4
-0
未找到文件。
src/share/vm/gc_implementation/shared/vmGCOperations.hpp
浏览文件 @
f6921aa8
...
...
@@ -214,9 +214,6 @@ class VM_CollectForMetadataAllocation: public VM_GC_Operation {
:
VM_GC_Operation
(
gc_count_before
,
gc_cause
,
full_gc_count_before
,
true
),
_loader_data
(
loader_data
),
_size
(
size
),
_mdtype
(
mdtype
),
_result
(
NULL
)
{
}
~
VM_CollectForMetadataAllocation
()
{
MetaspaceGC
::
set_expand_after_GC
(
false
);
}
virtual
VMOp_Type
type
()
const
{
return
VMOp_CollectForMetadataAllocation
;
}
virtual
void
doit
();
MetaWord
*
result
()
const
{
return
_result
;
}
...
...
src/share/vm/gc_interface/collectedHeap.cpp
浏览文件 @
f6921aa8
...
...
@@ -202,12 +202,6 @@ void CollectedHeap::collect_as_vm_thread(GCCause::Cause cause) {
ShouldNotReachHere
();
// Unexpected use of this function
}
}
MetaWord
*
CollectedHeap
::
satisfy_failed_metadata_allocation
(
ClassLoaderData
*
loader_data
,
size_t
size
,
Metaspace
::
MetadataType
mdtype
)
{
return
collector_policy
()
->
satisfy_failed_metadata_allocation
(
loader_data
,
size
,
mdtype
);
}
void
CollectedHeap
::
pre_initialize
()
{
// Used for ReduceInitialCardMarks (when COMPILER2 is used);
...
...
src/share/vm/gc_interface/collectedHeap.hpp
浏览文件 @
f6921aa8
...
...
@@ -475,11 +475,6 @@ class CollectedHeap : public CHeapObj<mtInternal> {
// the context of the vm thread.
virtual
void
collect_as_vm_thread
(
GCCause
::
Cause
cause
);
// Callback from VM_CollectForMetadataAllocation operation.
MetaWord
*
satisfy_failed_metadata_allocation
(
ClassLoaderData
*
loader_data
,
size_t
size
,
Metaspace
::
MetadataType
mdtype
);
// Returns the barrier set for this heap
BarrierSet
*
barrier_set
()
{
return
_barrier_set
;
}
...
...
src/share/vm/memory/collectorPolicy.cpp
浏览文件 @
f6921aa8
...
...
@@ -47,11 +47,6 @@
// CollectorPolicy methods.
// Align down. If the aligning result in 0, return 'alignment'.
static
size_t
restricted_align_down
(
size_t
size
,
size_t
alignment
)
{
return
MAX2
(
alignment
,
align_size_down_
(
size
,
alignment
));
}
void
CollectorPolicy
::
initialize_flags
()
{
assert
(
_max_alignment
>=
_min_alignment
,
err_msg
(
"max_alignment: "
SIZE_FORMAT
" less than min_alignment: "
SIZE_FORMAT
,
...
...
@@ -64,34 +59,7 @@ void CollectorPolicy::initialize_flags() {
vm_exit_during_initialization
(
"Incompatible initial and maximum heap sizes specified"
);
}
// Do not use FLAG_SET_ERGO to update MaxMetaspaceSize, since this will
// override if MaxMetaspaceSize was set on the command line or not.
// This information is needed later to conform to the specification of the
// java.lang.management.MemoryUsage API.
//
// Ideally, we would be able to set the default value of MaxMetaspaceSize in
// globals.hpp to the aligned value, but this is not possible, since the
// alignment depends on other flags being parsed.
MaxMetaspaceSize
=
restricted_align_down
(
MaxMetaspaceSize
,
_max_alignment
);
if
(
MetaspaceSize
>
MaxMetaspaceSize
)
{
MetaspaceSize
=
MaxMetaspaceSize
;
}
MetaspaceSize
=
restricted_align_down
(
MetaspaceSize
,
_min_alignment
);
assert
(
MetaspaceSize
<=
MaxMetaspaceSize
,
"Must be"
);
MinMetaspaceExpansion
=
restricted_align_down
(
MinMetaspaceExpansion
,
_min_alignment
);
MaxMetaspaceExpansion
=
restricted_align_down
(
MaxMetaspaceExpansion
,
_min_alignment
);
MinHeapDeltaBytes
=
align_size_up
(
MinHeapDeltaBytes
,
_min_alignment
);
assert
(
MetaspaceSize
%
_min_alignment
==
0
,
"metapace alignment"
);
assert
(
MaxMetaspaceSize
%
_max_alignment
==
0
,
"maximum metaspace alignment"
);
if
(
MetaspaceSize
<
256
*
K
)
{
vm_exit_during_initialization
(
"Too small initial Metaspace size"
);
}
}
void
CollectorPolicy
::
initialize_size_info
()
{
...
...
src/share/vm/memory/filemap.hpp
浏览文件 @
f6921aa8
...
...
@@ -26,6 +26,7 @@
#define SHARE_VM_MEMORY_FILEMAP_HPP
#include "memory/metaspaceShared.hpp"
#include "memory/metaspace.hpp"
// Layout of the file:
// header: dump of archive instance plus versioning info, datestamp, etc.
...
...
src/share/vm/memory/metaspace.cpp
浏览文件 @
f6921aa8
此差异已折叠。
点击以展开。
src/share/vm/memory/metaspace.hpp
浏览文件 @
f6921aa8
...
...
@@ -87,9 +87,10 @@ class Metaspace : public CHeapObj<mtClass> {
friend
class
MetaspaceAux
;
public:
enum
MetadataType
{
ClassType
=
0
,
NonClassType
=
ClassType
+
1
,
MetadataTypeCount
=
ClassType
+
2
enum
MetadataType
{
ClassType
,
NonClassType
,
MetadataTypeCount
};
enum
MetaspaceType
{
StandardMetaspaceType
,
...
...
@@ -103,6 +104,9 @@ class Metaspace : public CHeapObj<mtClass> {
private:
void
initialize
(
Mutex
*
lock
,
MetaspaceType
type
);
// Get the first chunk for a Metaspace. Used for
// special cases such as the boot class loader, reflection
// class loader and anonymous class loader.
Metachunk
*
get_initialization_chunk
(
MetadataType
mdtype
,
size_t
chunk_word_size
,
size_t
chunk_bunch
);
...
...
@@ -123,6 +127,9 @@ class Metaspace : public CHeapObj<mtClass> {
static
size_t
_first_chunk_word_size
;
static
size_t
_first_class_chunk_word_size
;
static
size_t
_commit_alignment
;
static
size_t
_reserve_alignment
;
SpaceManager
*
_vsm
;
SpaceManager
*
vsm
()
const
{
return
_vsm
;
}
...
...
@@ -191,12 +198,17 @@ class Metaspace : public CHeapObj<mtClass> {
Metaspace
(
Mutex
*
lock
,
MetaspaceType
type
);
~
Metaspace
();
// Initialize globals for Metaspace
static
void
ergo_initialize
();
static
void
global_initialize
();
static
size_t
first_chunk_word_size
()
{
return
_first_chunk_word_size
;
}
static
size_t
first_class_chunk_word_size
()
{
return
_first_class_chunk_word_size
;
}
static
size_t
reserve_alignment
()
{
return
_reserve_alignment
;
}
static
size_t
reserve_alignment_words
()
{
return
_reserve_alignment
/
BytesPerWord
;
}
static
size_t
commit_alignment
()
{
return
_commit_alignment
;
}
static
size_t
commit_alignment_words
()
{
return
_commit_alignment
/
BytesPerWord
;
}
char
*
bottom
()
const
;
size_t
used_words_slow
(
MetadataType
mdtype
)
const
;
size_t
free_words_slow
(
MetadataType
mdtype
)
const
;
...
...
@@ -219,6 +231,9 @@ class Metaspace : public CHeapObj<mtClass> {
static
void
purge
(
MetadataType
mdtype
);
static
void
purge
();
static
void
report_metadata_oome
(
ClassLoaderData
*
loader_data
,
size_t
word_size
,
MetadataType
mdtype
,
TRAPS
);
void
print_on
(
outputStream
*
st
)
const
;
// Debugging support
void
verify
();
...
...
@@ -352,17 +367,10 @@ class MetaspaceAux : AllStatic {
class
MetaspaceGC
:
AllStatic
{
// The current high-water-mark for inducing a GC. When
// the capacity of all space in the virtual lists reaches this value,
// a GC is induced and the value is increased. This should be changed
// to the space actually used for allocations to avoid affects of
// fragmentation losses to partially used chunks. Size is in words.
static
size_t
_capacity_until_GC
;
// After a GC is done any allocation that fails should try to expand
// the capacity of the Metaspaces. This flag is set during attempts
// to allocate in the VMGCOperation that does the GC.
static
bool
_expand_after_GC
;
// The current high-water-mark for inducing a GC.
// When committed memory of all metaspaces reaches this value,
// a GC is induced and the value is increased. Size is in bytes.
static
volatile
intptr_t
_capacity_until_GC
;
// For a CMS collection, signal that a concurrent collection should
// be started.
...
...
@@ -370,20 +378,16 @@ class MetaspaceGC : AllStatic {
static
uint
_shrink_factor
;
static
void
set_capacity_until_GC
(
size_t
v
)
{
_capacity_until_GC
=
v
;
}
static
size_t
shrink_factor
()
{
return
_shrink_factor
;
}
void
set_shrink_factor
(
uint
v
)
{
_shrink_factor
=
v
;
}
public:
static
size_t
capacity_until_GC
()
{
return
_capacity_until_GC
;
}
static
void
inc_capacity_until_GC
(
size_t
v
)
{
_capacity_until_GC
+=
v
;
}
static
void
dec_capacity_until_GC
(
size_t
v
)
{
_capacity_until_GC
=
_capacity_until_GC
>
v
?
_capacity_until_GC
-
v
:
0
;
}
static
bool
expand_after_GC
()
{
return
_expand_after_GC
;
}
static
void
set_expand_after_GC
(
bool
v
)
{
_expand_after_GC
=
v
;
}
static
void
initialize
()
{
_capacity_until_GC
=
MetaspaceSize
;
}
static
size_t
capacity_until_GC
();
static
size_t
inc_capacity_until_GC
(
size_t
v
);
static
size_t
dec_capacity_until_GC
(
size_t
v
);
static
bool
should_concurrent_collect
()
{
return
_should_concurrent_collect
;
}
static
void
set_should_concurrent_collect
(
bool
v
)
{
...
...
@@ -391,11 +395,14 @@ class MetaspaceGC : AllStatic {
}
// The amount to increase the high-water-mark (_capacity_until_GC)
static
size_t
delta_capacity_until_GC
(
size_t
word_size
);
static
size_t
delta_capacity_until_GC
(
size_t
bytes
);
// Tells if we have can expand metaspace without hitting set limits.
static
bool
can_expand
(
size_t
words
,
bool
is_class
);
//
It is expected that this will be called when the current capacity
//
has been used and a GC should be considered
.
static
bool
should_expand
(
VirtualSpaceList
*
vsl
,
size_t
word_size
);
//
Returns amount that we can expand without hitting a GC,
//
measured in words
.
static
size_t
allowed_expansion
(
);
// Calculate the new high-water mark at which to induce
// a GC.
...
...
src/share/vm/runtime/arguments.cpp
浏览文件 @
f6921aa8
...
...
@@ -3656,6 +3656,9 @@ jint Arguments::apply_ergo() {
assert
(
verify_serial_gc_flags
(),
"SerialGC unset"
);
#endif // INCLUDE_ALL_GCS
// Initialize Metaspace flags and alignments.
Metaspace
::
ergo_initialize
();
// Set bytecode rewriting flags
set_bytecode_flags
();
...
...
src/share/vm/runtime/globals.hpp
浏览文件 @
f6921aa8
...
...
@@ -502,6 +502,10 @@ class CommandLineFlags {
develop(bool, LargePagesIndividualAllocationInjectError, false, \
"Fail large pages individual allocation") \
\
product(bool, UseLargePagesInMetaspace, false, \
"Use large page memory in metaspace. " \
"Only used if UseLargePages is enabled.") \
\
develop(bool, TracePageSizes, false, \
"Trace page size selection and usage") \
\
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录