Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_hotspot
提交
708c714d
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看板
提交
708c714d
编写于
2月 01, 2013
作者:
J
jmasa
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
7189971: Implement CMSWaitDuration for non-incremental mode of CMS
Reviewed-by: jmasa, johnc, ysr Contributed-by: michal@frajt.eu
上级
a975965f
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
99 addition
and
5 deletion
+99
-5
src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepThread.cpp
...ntation/concurrentMarkSweep/concurrentMarkSweepThread.cpp
+89
-5
src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepThread.hpp
...ntation/concurrentMarkSweep/concurrentMarkSweepThread.hpp
+6
-0
src/share/vm/runtime/globals.hpp
src/share/vm/runtime/globals.hpp
+4
-0
未找到文件。
src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepThread.cpp
浏览文件 @
708c714d
...
...
@@ -300,8 +300,7 @@ void ConcurrentMarkSweepThread::desynchronize(bool is_cms_thread) {
}
}
// Wait until the next synchronous GC, a concurrent full gc request,
// or a timeout, whichever is earlier.
// Wait until any cms_lock event
void
ConcurrentMarkSweepThread
::
wait_on_cms_lock
(
long
t_millis
)
{
MutexLockerEx
x
(
CGC_lock
,
Mutex
::
_no_safepoint_check_flag
);
...
...
@@ -315,15 +314,100 @@ void ConcurrentMarkSweepThread::wait_on_cms_lock(long t_millis) {
"Should not be set"
);
}
// Wait until the next synchronous GC, a concurrent full gc request,
// or a timeout, whichever is earlier.
void
ConcurrentMarkSweepThread
::
wait_on_cms_lock_for_scavenge
(
long
t_millis
)
{
// Wait time in millis or 0 value representing infinite wait for a scavenge
assert
(
t_millis
>=
0
,
"Wait time for scavenge should be 0 or positive"
);
GenCollectedHeap
*
gch
=
GenCollectedHeap
::
heap
();
double
start_time_secs
=
os
::
elapsedTime
();
double
end_time_secs
=
start_time_secs
+
(
t_millis
/
((
double
)
MILLIUNITS
));
// Total collections count before waiting loop
unsigned
int
before_count
;
{
MutexLockerEx
hl
(
Heap_lock
,
Mutex
::
_no_safepoint_check_flag
);
before_count
=
gch
->
total_collections
();
}
unsigned
int
loop_count
=
0
;
while
(
!
_should_terminate
)
{
double
now_time
=
os
::
elapsedTime
();
long
wait_time_millis
;
if
(
t_millis
!=
0
)
{
// New wait limit
wait_time_millis
=
(
long
)
((
end_time_secs
-
now_time
)
*
MILLIUNITS
);
if
(
wait_time_millis
<=
0
)
{
// Wait time is over
break
;
}
}
else
{
// No wait limit, wait if necessary forever
wait_time_millis
=
0
;
}
// Wait until the next event or the remaining timeout
{
MutexLockerEx
x
(
CGC_lock
,
Mutex
::
_no_safepoint_check_flag
);
if
(
_should_terminate
||
_collector
->
_full_gc_requested
)
{
return
;
}
set_CMS_flag
(
CMS_cms_wants_token
);
// to provoke notifies
assert
(
t_millis
==
0
||
wait_time_millis
>
0
,
"Sanity"
);
CGC_lock
->
wait
(
Mutex
::
_no_safepoint_check_flag
,
wait_time_millis
);
clear_CMS_flag
(
CMS_cms_wants_token
);
assert
(
!
CMS_flag_is_set
(
CMS_cms_has_token
|
CMS_cms_wants_token
),
"Should not be set"
);
}
// Extra wait time check before entering the heap lock to get the collection count
if
(
t_millis
!=
0
&&
os
::
elapsedTime
()
>=
end_time_secs
)
{
// Wait time is over
break
;
}
// Total collections count after the event
unsigned
int
after_count
;
{
MutexLockerEx
hl
(
Heap_lock
,
Mutex
::
_no_safepoint_check_flag
);
after_count
=
gch
->
total_collections
();
}
if
(
before_count
!=
after_count
)
{
// There was a collection - success
break
;
}
// Too many loops warning
if
(
++
loop_count
==
0
)
{
warning
(
"wait_on_cms_lock_for_scavenge() has looped %u times"
,
loop_count
-
1
);
}
}
}
void
ConcurrentMarkSweepThread
::
sleepBeforeNextCycle
()
{
while
(
!
_should_terminate
)
{
if
(
CMSIncrementalMode
)
{
icms_wait
();
if
(
CMSWaitDuration
>=
0
)
{
// Wait until the next synchronous GC, a concurrent full gc
// request or a timeout, whichever is earlier.
wait_on_cms_lock_for_scavenge
(
CMSWaitDuration
);
}
return
;
}
else
{
if
(
CMSWaitDuration
>=
0
)
{
// Wait until the next synchronous GC, a concurrent full gc
// request or a timeout, whichever is earlier.
wait_on_cms_lock
(
CMSWaitDuration
);
wait_on_cms_lock_for_scavenge
(
CMSWaitDuration
);
}
else
{
// Wait until any cms_lock event or check interval not to call shouldConcurrentCollect permanently
wait_on_cms_lock
(
CMSCheckInterval
);
}
}
// Check if we should start a CMS collection cycle
if
(
_collector
->
shouldConcurrentCollect
())
{
...
...
src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepThread.hpp
浏览文件 @
708c714d
...
...
@@ -130,6 +130,12 @@ class ConcurrentMarkSweepThread: public ConcurrentGCThread {
// A concurrent full gc request terminates the wait.
void
wait_on_cms_lock
(
long
t_millis
);
// Wait on CMS lock until the next synchronous GC
// or given timeout, whichever is earlier. A timeout value
// of 0 indicates that there is no upper bound on the wait time.
// A concurrent full gc request terminates the wait.
void
wait_on_cms_lock_for_scavenge
(
long
t_millis
);
// The CMS thread will yield during the work portion of its cycle
// only when requested to. Both synchronous and asychronous requests
// are provided:
...
...
src/share/vm/runtime/globals.hpp
浏览文件 @
708c714d
...
...
@@ -1751,6 +1751,10 @@ class CommandLineFlags {
manageable(intx, CMSWaitDuration, 2000, \
"Time in milliseconds that CMS thread waits for young GC") \
\
develop(uintx, CMSCheckInterval, 1000, \
"Interval in milliseconds that CMS thread checks if it " \
"should start a collection cycle") \
\
product(bool, CMSYield, true, \
"Yield between steps of concurrent mark & sweep") \
\
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录