Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_hotspot
提交
c6d33699
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看板
提交
c6d33699
编写于
2月 06, 2019
作者:
Y
ysuenaga
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8217432: MetaspaceGC::_capacity_until_GC exceeds MaxMetaspaceSize
Reviewed-by: tschatzl, stuefe
上级
1e4278d3
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
29 addition
and
8 deletion
+29
-8
src/share/vm/memory/metaspace.cpp
src/share/vm/memory/metaspace.cpp
+26
-6
src/share/vm/memory/metaspace.hpp
src/share/vm/memory/metaspace.hpp
+3
-2
未找到文件。
src/share/vm/memory/metaspace.cpp
浏览文件 @
c6d33699
/*
* Copyright (c) 2011, 201
8
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 201
9
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
...
...
@@ -1422,7 +1422,15 @@ size_t MetaspaceGC::capacity_until_GC() {
return
value
;
}
bool
MetaspaceGC
::
inc_capacity_until_GC
(
size_t
v
,
size_t
*
new_cap_until_GC
,
size_t
*
old_cap_until_GC
)
{
// Try to increase the _capacity_until_GC limit counter by v bytes.
// Returns true if it succeeded. It may fail if either another thread
// concurrently increased the limit or the new limit would be larger
// than MaxMetaspaceSize.
// On success, optionally returns new and old metaspace capacity in
// new_cap_until_GC and old_cap_until_GC respectively.
// On error, optionally sets can_retry to indicate whether if there is
// actually enough space remaining to satisfy the request.
bool
MetaspaceGC
::
inc_capacity_until_GC
(
size_t
v
,
size_t
*
new_cap_until_GC
,
size_t
*
old_cap_until_GC
,
bool
*
can_retry
)
{
assert_is_size_aligned
(
v
,
Metaspace
::
commit_alignment
());
size_t
capacity_until_GC
=
(
size_t
)
_capacity_until_GC
;
...
...
@@ -1433,6 +1441,17 @@ bool MetaspaceGC::inc_capacity_until_GC(size_t v, size_t* new_cap_until_GC, size
new_value
=
align_size_down
(
max_uintx
,
Metaspace
::
commit_alignment
());
}
if
(
new_value
>
MaxMetaspaceSize
)
{
if
(
can_retry
!=
NULL
)
{
*
can_retry
=
false
;
}
return
false
;
}
if
(
can_retry
!=
NULL
)
{
*
can_retry
=
true
;
}
intptr_t
expected
=
(
intptr_t
)
capacity_until_GC
;
intptr_t
actual
=
Atomic
::
cmpxchg_ptr
((
intptr_t
)
new_value
,
&
_capacity_until_GC
,
expected
);
...
...
@@ -1520,7 +1539,7 @@ void MetaspaceGC::compute_new_size() {
const
double
min_tmp
=
used_after_gc
/
maximum_used_percentage
;
size_t
minimum_desired_capacity
=
(
size_t
)
MIN2
(
min_tmp
,
double
(
max_uintx
));
(
size_t
)
MIN2
(
min_tmp
,
double
(
MaxMetaspaceSize
));
// Don't shrink less than the initial generation size
minimum_desired_capacity
=
MAX2
(
minimum_desired_capacity
,
MetaspaceSize
);
...
...
@@ -1579,7 +1598,7 @@ void MetaspaceGC::compute_new_size() {
const
double
maximum_free_percentage
=
MaxMetaspaceFreeRatio
/
100.0
;
const
double
minimum_used_percentage
=
1.0
-
maximum_free_percentage
;
const
double
max_tmp
=
used_after_gc
/
minimum_used_percentage
;
size_t
maximum_desired_capacity
=
(
size_t
)
MIN2
(
max_tmp
,
double
(
max_uintx
));
size_t
maximum_desired_capacity
=
(
size_t
)
MIN2
(
max_tmp
,
double
(
MaxMetaspaceSize
));
maximum_desired_capacity
=
MAX2
(
maximum_desired_capacity
,
MetaspaceSize
);
if
(
PrintGCDetails
&&
Verbose
)
{
...
...
@@ -3408,6 +3427,7 @@ MetaWord* Metaspace::expand_and_allocate(size_t word_size, MetadataType mdtype)
size_t
before
=
0
;
size_t
after
=
0
;
bool
can_retry
=
true
;
MetaWord
*
res
;
bool
incremented
;
...
...
@@ -3415,9 +3435,9 @@ MetaWord* Metaspace::expand_and_allocate(size_t word_size, MetadataType mdtype)
// the HWM, an allocation is still attempted. This is because another thread must then
// have incremented the HWM and therefore the allocation might still succeed.
do
{
incremented
=
MetaspaceGC
::
inc_capacity_until_GC
(
delta_bytes
,
&
after
,
&
before
);
incremented
=
MetaspaceGC
::
inc_capacity_until_GC
(
delta_bytes
,
&
after
,
&
before
,
&
can_retry
);
res
=
allocate
(
word_size
,
mdtype
);
}
while
(
!
incremented
&&
res
==
NULL
);
}
while
(
!
incremented
&&
res
==
NULL
&&
can_retry
);
if
(
incremented
)
{
tracer
()
->
report_gc_threshold
(
before
,
after
,
...
...
src/share/vm/memory/metaspace.hpp
浏览文件 @
c6d33699
/*
* Copyright (c) 2011, 201
8
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 201
9
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
...
...
@@ -416,7 +416,8 @@ class MetaspaceGC : AllStatic {
static
size_t
capacity_until_GC
();
static
bool
inc_capacity_until_GC
(
size_t
v
,
size_t
*
new_cap_until_GC
=
NULL
,
size_t
*
old_cap_until_GC
=
NULL
);
size_t
*
old_cap_until_GC
=
NULL
,
bool
*
can_retry
=
NULL
);
static
size_t
dec_capacity_until_GC
(
size_t
v
);
static
bool
should_concurrent_collect
()
{
return
_should_concurrent_collect
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录