Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_hotspot
提交
a5e75e63
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看板
提交
a5e75e63
编写于
1月 16, 2012
作者:
B
brutisso
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
6976060: G1: humongous object allocations should initiate marking cycles when necessary
Reviewed-by: tonyp, johnc
上级
a30e9e27
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
85 addition
and
53 deletion
+85
-53
src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp
src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp
+22
-10
src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp
src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp
+5
-0
src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp
src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp
+46
-37
src/share/vm/gc_implementation/g1/g1CollectorPolicy.hpp
src/share/vm/gc_implementation/g1/g1CollectorPolicy.hpp
+2
-1
src/share/vm/gc_implementation/g1/vm_operations_g1.cpp
src/share/vm/gc_implementation/g1/vm_operations_g1.cpp
+4
-3
src/share/vm/gc_interface/gcCause.cpp
src/share/vm/gc_interface/gcCause.cpp
+4
-1
src/share/vm/gc_interface/gcCause.hpp
src/share/vm/gc_interface/gcCause.hpp
+2
-1
未找到文件。
src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp
浏览文件 @
a5e75e63
...
@@ -1045,17 +1045,24 @@ HeapWord* G1CollectedHeap::attempt_allocation_humongous(size_t word_size,
...
@@ -1045,17 +1045,24 @@ HeapWord* G1CollectedHeap::attempt_allocation_humongous(size_t word_size,
// regions, we'll first try to do the allocation without doing a
// regions, we'll first try to do the allocation without doing a
// collection hoping that there's enough space in the heap.
// collection hoping that there's enough space in the heap.
result
=
humongous_obj_allocate
(
word_size
);
result
=
humongous_obj_allocate
(
word_size
);
if
(
result
!=
NULL
)
{
return
result
;
if
(
result
==
NULL
)
{
if
(
GC_locker
::
is_active_and_needs_gc
())
{
should_try_gc
=
false
;
}
else
{
// Read the GC count while still holding the Heap_lock.
gc_count_before
=
SharedHeap
::
heap
()
->
total_collections
();
should_try_gc
=
true
;
}
}
}
}
if
(
GC_locker
::
is_active_and_needs_gc
())
{
if
(
result
!=
NULL
)
{
should_try_gc
=
false
;
if
(
g1_policy
()
->
need_to_start_conc_mark
(
"concurrent humongous allocation"
))
{
}
else
{
// We need to release the Heap_lock before we try to call collect
// Read the GC count while still holding the Heap_lock.
collect
(
GCCause
::
_g1_humongous_allocation
);
gc_count_before
=
SharedHeap
::
heap
()
->
total_collections
();
should_try_gc
=
true
;
}
}
return
result
;
}
}
if
(
should_try_gc
)
{
if
(
should_try_gc
)
{
...
@@ -1111,7 +1118,11 @@ HeapWord* G1CollectedHeap::attempt_allocation_at_safepoint(size_t word_size,
...
@@ -1111,7 +1118,11 @@ HeapWord* G1CollectedHeap::attempt_allocation_at_safepoint(size_t word_size,
return
_mutator_alloc_region
.
attempt_allocation_locked
(
word_size
,
return
_mutator_alloc_region
.
attempt_allocation_locked
(
word_size
,
false
/* bot_updates */
);
false
/* bot_updates */
);
}
else
{
}
else
{
return
humongous_obj_allocate
(
word_size
);
HeapWord
*
result
=
humongous_obj_allocate
(
word_size
);
if
(
result
!=
NULL
&&
g1_policy
()
->
need_to_start_conc_mark
(
"STW humongous allocation"
))
{
g1_policy
()
->
set_initiate_conc_mark_if_possible
();
}
return
result
;
}
}
ShouldNotReachHere
();
ShouldNotReachHere
();
...
@@ -2295,7 +2306,8 @@ size_t G1CollectedHeap::unsafe_max_alloc() {
...
@@ -2295,7 +2306,8 @@ size_t G1CollectedHeap::unsafe_max_alloc() {
bool
G1CollectedHeap
::
should_do_concurrent_full_gc
(
GCCause
::
Cause
cause
)
{
bool
G1CollectedHeap
::
should_do_concurrent_full_gc
(
GCCause
::
Cause
cause
)
{
return
return
((
cause
==
GCCause
::
_gc_locker
&&
GCLockerInvokesConcurrent
)
||
((
cause
==
GCCause
::
_gc_locker
&&
GCLockerInvokesConcurrent
)
||
(
cause
==
GCCause
::
_java_lang_system_gc
&&
ExplicitGCInvokesConcurrent
));
(
cause
==
GCCause
::
_java_lang_system_gc
&&
ExplicitGCInvokesConcurrent
)
||
cause
==
GCCause
::
_g1_humongous_allocation
);
}
}
#ifndef PRODUCT
#ifndef PRODUCT
...
...
src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp
浏览文件 @
a5e75e63
...
@@ -355,6 +355,7 @@ private:
...
@@ -355,6 +355,7 @@ private:
// explicitly started if:
// explicitly started if:
// (a) cause == _gc_locker and +GCLockerInvokesConcurrent, or
// (a) cause == _gc_locker and +GCLockerInvokesConcurrent, or
// (b) cause == _java_lang_system_gc and +ExplicitGCInvokesConcurrent.
// (b) cause == _java_lang_system_gc and +ExplicitGCInvokesConcurrent.
// (c) cause == _g1_humongous_allocation
bool
should_do_concurrent_full_gc
(
GCCause
::
Cause
cause
);
bool
should_do_concurrent_full_gc
(
GCCause
::
Cause
cause
);
// Keeps track of how many "full collections" (i.e., Full GCs or
// Keeps track of how many "full collections" (i.e., Full GCs or
...
@@ -1172,6 +1173,10 @@ public:
...
@@ -1172,6 +1173,10 @@ public:
_old_set
.
remove
(
hr
);
_old_set
.
remove
(
hr
);
}
}
size_t
non_young_capacity_bytes
()
{
return
_old_set
.
total_capacity_bytes
()
+
_humongous_set
.
total_capacity_bytes
();
}
void
set_free_regions_coming
();
void
set_free_regions_coming
();
void
reset_free_regions_coming
();
void
reset_free_regions_coming
();
bool
free_regions_coming
()
{
return
_free_regions_coming
;
}
bool
free_regions_coming
()
{
return
_free_regions_coming
;
}
...
...
src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp
浏览文件 @
a5e75e63
...
@@ -213,8 +213,6 @@ G1CollectorPolicy::G1CollectorPolicy() :
...
@@ -213,8 +213,6 @@ G1CollectorPolicy::G1CollectorPolicy() :
_survivor_bytes_before_gc
(
0
),
_survivor_bytes_before_gc
(
0
),
_capacity_before_gc
(
0
),
_capacity_before_gc
(
0
),
_prev_collection_pause_used_at_end_bytes
(
0
),
_eden_cset_region_length
(
0
),
_eden_cset_region_length
(
0
),
_survivor_cset_region_length
(
0
),
_survivor_cset_region_length
(
0
),
_old_cset_region_length
(
0
),
_old_cset_region_length
(
0
),
...
@@ -1140,6 +1138,45 @@ double G1CollectorPolicy::max_sum(double* data1, double* data2) {
...
@@ -1140,6 +1138,45 @@ double G1CollectorPolicy::max_sum(double* data1, double* data2) {
return
ret
;
return
ret
;
}
}
bool
G1CollectorPolicy
::
need_to_start_conc_mark
(
const
char
*
source
)
{
if
(
_g1
->
mark_in_progress
())
{
return
false
;
}
size_t
marking_initiating_used_threshold
=
(
_g1
->
capacity
()
/
100
)
*
InitiatingHeapOccupancyPercent
;
size_t
cur_used_bytes
=
_g1
->
non_young_capacity_bytes
();
if
(
cur_used_bytes
>
marking_initiating_used_threshold
)
{
if
(
gcs_are_young
())
{
ergo_verbose4
(
ErgoConcCycles
,
"request concurrent cycle initiation"
,
ergo_format_reason
(
"occupancy higher than threshold"
)
ergo_format_byte
(
"occupancy"
)
ergo_format_byte_perc
(
"threshold"
)
ergo_format_str
(
"source"
),
cur_used_bytes
,
marking_initiating_used_threshold
,
(
double
)
InitiatingHeapOccupancyPercent
,
source
);
return
true
;
}
else
{
ergo_verbose4
(
ErgoConcCycles
,
"do not request concurrent cycle initiation"
,
ergo_format_reason
(
"still doing mixed collections"
)
ergo_format_byte
(
"occupancy"
)
ergo_format_byte_perc
(
"threshold"
)
ergo_format_str
(
"source"
),
cur_used_bytes
,
marking_initiating_used_threshold
,
(
double
)
InitiatingHeapOccupancyPercent
,
source
);
}
}
return
false
;
}
// Anything below that is considered to be zero
// Anything below that is considered to be zero
#define MIN_TIMER_GRANULARITY 0.0000001
#define MIN_TIMER_GRANULARITY 0.0000001
...
@@ -1166,44 +1203,16 @@ void G1CollectorPolicy::record_collection_pause_end(int no_of_gc_threads) {
...
@@ -1166,44 +1203,16 @@ void G1CollectorPolicy::record_collection_pause_end(int no_of_gc_threads) {
#endif // PRODUCT
#endif // PRODUCT
last_pause_included_initial_mark
=
during_initial_mark_pause
();
last_pause_included_initial_mark
=
during_initial_mark_pause
();
if
(
last_pause_included_initial_mark
)
if
(
last_pause_included_initial_mark
)
{
record_concurrent_mark_init_end
(
0.0
);
record_concurrent_mark_init_end
(
0.0
);
size_t
marking_initiating_used_threshold
=
(
_g1
->
capacity
()
/
100
)
*
InitiatingHeapOccupancyPercent
;
if
(
!
_g1
->
mark_in_progress
()
&&
!
_last_young_gc
)
{
assert
(
!
last_pause_included_initial_mark
,
"invariant"
);
if
(
cur_used_bytes
>
marking_initiating_used_threshold
)
{
if
(
cur_used_bytes
>
_prev_collection_pause_used_at_end_bytes
)
{
assert
(
!
during_initial_mark_pause
(),
"we should not see this here"
);
ergo_verbose3
(
ErgoConcCycles
,
"request concurrent cycle initiation"
,
ergo_format_reason
(
"occupancy higher than threshold"
)
ergo_format_byte
(
"occupancy"
)
ergo_format_byte_perc
(
"threshold"
),
cur_used_bytes
,
marking_initiating_used_threshold
,
(
double
)
InitiatingHeapOccupancyPercent
);
// Note: this might have already been set, if during the last
// pause we decided to start a cycle but at the beginning of
// this pause we decided to postpone it. That's OK.
set_initiate_conc_mark_if_possible
();
}
else
{
ergo_verbose2
(
ErgoConcCycles
,
"do not request concurrent cycle initiation"
,
ergo_format_reason
(
"occupancy lower than previous occupancy"
)
ergo_format_byte
(
"occupancy"
)
ergo_format_byte
(
"previous occupancy"
),
cur_used_bytes
,
_prev_collection_pause_used_at_end_bytes
);
}
}
}
}
_prev_collection_pause_used_at_end_bytes
=
cur_used_bytes
;
if
(
!
_last_young_gc
&&
need_to_start_conc_mark
(
"end of GC"
))
{
// Note: this might have already been set, if during the last
// pause we decided to start a cycle but at the beginning of
// this pause we decided to postpone it. That's OK.
set_initiate_conc_mark_if_possible
();
}
_mmu_tracker
->
add_pause
(
end_time_sec
-
elapsed_ms
/
1000.0
,
_mmu_tracker
->
add_pause
(
end_time_sec
-
elapsed_ms
/
1000.0
,
end_time_sec
,
false
);
end_time_sec
,
false
);
...
...
src/share/vm/gc_implementation/g1/g1CollectorPolicy.hpp
浏览文件 @
a5e75e63
...
@@ -177,7 +177,6 @@ private:
...
@@ -177,7 +177,6 @@ private:
double
_cur_collection_start_sec
;
double
_cur_collection_start_sec
;
size_t
_cur_collection_pause_used_at_start_bytes
;
size_t
_cur_collection_pause_used_at_start_bytes
;
size_t
_cur_collection_pause_used_regions_at_start
;
size_t
_cur_collection_pause_used_regions_at_start
;
size_t
_prev_collection_pause_used_at_end_bytes
;
double
_cur_collection_par_time_ms
;
double
_cur_collection_par_time_ms
;
double
_cur_satb_drain_time_ms
;
double
_cur_satb_drain_time_ms
;
double
_cur_clear_ct_time_ms
;
double
_cur_clear_ct_time_ms
;
...
@@ -800,6 +799,8 @@ public:
...
@@ -800,6 +799,8 @@ public:
GenRemSet
::
Name
rem_set_name
()
{
return
GenRemSet
::
CardTable
;
}
GenRemSet
::
Name
rem_set_name
()
{
return
GenRemSet
::
CardTable
;
}
bool
need_to_start_conc_mark
(
const
char
*
source
);
// Update the heuristic info to record a collection pause of the given
// Update the heuristic info to record a collection pause of the given
// start time, where the given number of bytes were used at the start.
// start time, where the given number of bytes were used at the start.
// This may involve changing the desired size of a collection set.
// This may involve changing the desired size of a collection set.
...
...
src/share/vm/gc_implementation/g1/vm_operations_g1.cpp
浏览文件 @
a5e75e63
/*
/*
* Copyright (c) 2001, 201
1
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 201
2
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -74,8 +74,9 @@ void VM_G1IncCollectionPause::doit() {
...
@@ -74,8 +74,9 @@ void VM_G1IncCollectionPause::doit() {
G1CollectedHeap
*
g1h
=
G1CollectedHeap
::
heap
();
G1CollectedHeap
*
g1h
=
G1CollectedHeap
::
heap
();
assert
(
!
_should_initiate_conc_mark
||
assert
(
!
_should_initiate_conc_mark
||
((
_gc_cause
==
GCCause
::
_gc_locker
&&
GCLockerInvokesConcurrent
)
||
((
_gc_cause
==
GCCause
::
_gc_locker
&&
GCLockerInvokesConcurrent
)
||
(
_gc_cause
==
GCCause
::
_java_lang_system_gc
&&
ExplicitGCInvokesConcurrent
)),
(
_gc_cause
==
GCCause
::
_java_lang_system_gc
&&
ExplicitGCInvokesConcurrent
)
||
"only a GC locker or a System.gc() induced GC should start a cycle"
);
_gc_cause
==
GCCause
::
_g1_humongous_allocation
),
"only a GC locker, a System.gc() or a hum allocation induced GC should start a cycle"
);
if
(
_word_size
>
0
)
{
if
(
_word_size
>
0
)
{
// An allocation has been requested. So, try to do that first.
// An allocation has been requested. So, try to do that first.
...
...
src/share/vm/gc_interface/gcCause.cpp
浏览文件 @
a5e75e63
/*
/*
* Copyright (c) 2002, 201
1
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2002, 201
2
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -84,6 +84,9 @@ const char* GCCause::to_string(GCCause::Cause cause) {
...
@@ -84,6 +84,9 @@ const char* GCCause::to_string(GCCause::Cause cause) {
case
_g1_inc_collection_pause
:
case
_g1_inc_collection_pause
:
return
"G1 Evacuation Pause"
;
return
"G1 Evacuation Pause"
;
case
_g1_humongous_allocation
:
return
"G1 Humongous Allocation"
;
case
_last_ditch_collection
:
case
_last_ditch_collection
:
return
"Last ditch collection"
;
return
"Last ditch collection"
;
...
...
src/share/vm/gc_interface/gcCause.hpp
浏览文件 @
a5e75e63
/*
/*
* Copyright (c) 2002, 201
1
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2002, 201
2
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -66,6 +66,7 @@ class GCCause : public AllStatic {
...
@@ -66,6 +66,7 @@ class GCCause : public AllStatic {
_adaptive_size_policy
,
_adaptive_size_policy
,
_g1_inc_collection_pause
,
_g1_inc_collection_pause
,
_g1_humongous_allocation
,
_last_ditch_collection
,
_last_ditch_collection
,
_last_gc_cause
_last_gc_cause
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录