Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_hotspot
提交
7b13a7fe
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看板
提交
7b13a7fe
编写于
10月 05, 2013
作者:
S
stefank
浏览文件
操作
浏览文件
下载
差异文件
Merge
上级
b6c29fc0
39578cad
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
411 addition
and
10 deletion
+411
-10
src/os/linux/vm/globals_linux.hpp
src/os/linux/vm/globals_linux.hpp
+1
-1
src/os/linux/vm/os_linux.cpp
src/os/linux/vm/os_linux.cpp
+21
-9
test/runtime/memory/LargePages/TestLargePagesFlags.java
test/runtime/memory/LargePages/TestLargePagesFlags.java
+389
-0
未找到文件。
src/os/linux/vm/globals_linux.hpp
浏览文件 @
7b13a7fe
...
@@ -53,7 +53,7 @@
...
@@ -53,7 +53,7 @@
// Defines Linux-specific default values. The flags are available on all
// Defines Linux-specific default values. The flags are available on all
// platforms, but they may have different default values on other platforms.
// platforms, but they may have different default values on other platforms.
//
//
define_pd_global
(
bool
,
UseLargePages
,
tru
e
);
define_pd_global
(
bool
,
UseLargePages
,
fals
e
);
define_pd_global
(
bool
,
UseLargePagesIndividualAllocation
,
false
);
define_pd_global
(
bool
,
UseLargePagesIndividualAllocation
,
false
);
define_pd_global
(
bool
,
UseOSErrorReporting
,
false
);
define_pd_global
(
bool
,
UseOSErrorReporting
,
false
);
define_pd_global
(
bool
,
UseThreadPriorities
,
true
)
;
define_pd_global
(
bool
,
UseThreadPriorities
,
true
)
;
...
...
src/os/linux/vm/os_linux.cpp
浏览文件 @
7b13a7fe
...
@@ -3361,13 +3361,15 @@ bool os::Linux::setup_large_page_type(size_t page_size) {
...
@@ -3361,13 +3361,15 @@ bool os::Linux::setup_large_page_type(size_t page_size) {
if
(
FLAG_IS_DEFAULT
(
UseHugeTLBFS
)
&&
if
(
FLAG_IS_DEFAULT
(
UseHugeTLBFS
)
&&
FLAG_IS_DEFAULT
(
UseSHM
)
&&
FLAG_IS_DEFAULT
(
UseSHM
)
&&
FLAG_IS_DEFAULT
(
UseTransparentHugePages
))
{
FLAG_IS_DEFAULT
(
UseTransparentHugePages
))
{
// If UseLargePages is specified on the command line try all methods,
// if it's default, then try only UseTransparentHugePages.
// The type of large pages has not been specified by the user.
if
(
FLAG_IS_DEFAULT
(
UseLargePages
))
{
UseTransparentHugePages
=
true
;
// Try UseHugeTLBFS and then UseSHM.
}
else
{
UseHugeTLBFS
=
UseSHM
=
true
;
UseHugeTLBFS
=
UseTransparentHugePages
=
UseSHM
=
true
;
}
// Don't try UseTransparentHugePages since there are known
// performance issues with it turned on. This might change in the future.
UseTransparentHugePages
=
false
;
}
}
if
(
UseTransparentHugePages
)
{
if
(
UseTransparentHugePages
)
{
...
@@ -3393,9 +3395,19 @@ bool os::Linux::setup_large_page_type(size_t page_size) {
...
@@ -3393,9 +3395,19 @@ bool os::Linux::setup_large_page_type(size_t page_size) {
}
}
void
os
::
large_page_init
()
{
void
os
::
large_page_init
()
{
if
(
!
UseLargePages
)
{
if
(
!
UseLargePages
&&
UseHugeTLBFS
=
false
;
!
UseTransparentHugePages
&&
!
UseHugeTLBFS
&&
!
UseSHM
)
{
// Not using large pages.
return
;
}
if
(
!
FLAG_IS_DEFAULT
(
UseLargePages
)
&&
!
UseLargePages
)
{
// The user explicitly turned off large pages.
// Ignore the rest of the large pages flags.
UseTransparentHugePages
=
false
;
UseTransparentHugePages
=
false
;
UseHugeTLBFS
=
false
;
UseSHM
=
false
;
UseSHM
=
false
;
return
;
return
;
}
}
...
...
test/runtime/memory/LargePages/TestLargePagesFlags.java
0 → 100644
浏览文件 @
7b13a7fe
/*
* Copyright (c) 2013, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/* @test TestLargePagesFlags
* @summary Tests how large pages are choosen depending on the given large pages flag combinations.
* @library /testlibrary
* @run main TestLargePagesFlags
*/
import
com.oracle.java.testlibrary.OutputAnalyzer
;
import
com.oracle.java.testlibrary.Platform
;
import
com.oracle.java.testlibrary.ProcessTools
;
import
java.util.ArrayList
;
public
class
TestLargePagesFlags
{
public
static
void
main
(
String
[]
args
)
throws
Exception
{
if
(!
Platform
.
isLinux
())
{
System
.
out
.
println
(
"Skipping. TestLargePagesFlags has only been implemented for Linux."
);
return
;
}
testUseTransparentHugePages
();
testUseHugeTLBFS
();
testUseSHM
();
testCombinations
();
}
public
static
void
testUseTransparentHugePages
()
throws
Exception
{
if
(!
canUse
(
UseTransparentHugePages
(
true
)))
{
System
.
out
.
println
(
"Skipping testUseTransparentHugePages"
);
return
;
}
// -XX:-UseLargePages overrides all other flags.
new
FlagTester
()
.
use
(
UseLargePages
(
false
),
UseTransparentHugePages
(
true
))
.
expect
(
UseLargePages
(
false
),
UseTransparentHugePages
(
false
),
UseHugeTLBFS
(
false
),
UseSHM
(
false
));
// Explicitly turn on UseTransparentHugePages.
new
FlagTester
()
.
use
(
UseTransparentHugePages
(
true
))
.
expect
(
UseLargePages
(
true
),
UseTransparentHugePages
(
true
),
UseHugeTLBFS
(
false
),
UseSHM
(
false
));
new
FlagTester
()
.
use
(
UseLargePages
(
true
),
UseTransparentHugePages
(
true
))
.
expect
(
UseLargePages
(
true
),
UseTransparentHugePages
(
true
),
UseHugeTLBFS
(
false
),
UseSHM
(
false
));
// Setting a specific large pages flag will turn
// off heuristics to choose large pages type.
new
FlagTester
()
.
use
(
UseLargePages
(
true
),
UseTransparentHugePages
(
false
))
.
expect
(
UseLargePages
(
false
),
UseTransparentHugePages
(
false
),
UseHugeTLBFS
(
false
),
UseSHM
(
false
));
// Don't turn on UseTransparentHugePages
// unless the user explicitly asks for them.
new
FlagTester
()
.
use
(
UseLargePages
(
true
))
.
expect
(
UseTransparentHugePages
(
false
));
}
public
static
void
testUseHugeTLBFS
()
throws
Exception
{
if
(!
canUse
(
UseHugeTLBFS
(
true
)))
{
System
.
out
.
println
(
"Skipping testUseHugeTLBFS"
);
return
;
}
// -XX:-UseLargePages overrides all other flags.
new
FlagTester
()
.
use
(
UseLargePages
(
false
),
UseHugeTLBFS
(
true
))
.
expect
(
UseLargePages
(
false
),
UseTransparentHugePages
(
false
),
UseHugeTLBFS
(
false
),
UseSHM
(
false
));
// Explicitly turn on UseHugeTLBFS.
new
FlagTester
()
.
use
(
UseHugeTLBFS
(
true
))
.
expect
(
UseLargePages
(
true
),
UseTransparentHugePages
(
false
),
UseHugeTLBFS
(
true
),
UseSHM
(
false
));
new
FlagTester
()
.
use
(
UseLargePages
(
true
),
UseHugeTLBFS
(
true
))
.
expect
(
UseLargePages
(
true
),
UseTransparentHugePages
(
false
),
UseHugeTLBFS
(
true
),
UseSHM
(
false
));
// Setting a specific large pages flag will turn
// off heuristics to choose large pages type.
new
FlagTester
()
.
use
(
UseLargePages
(
true
),
UseHugeTLBFS
(
false
))
.
expect
(
UseLargePages
(
false
),
UseTransparentHugePages
(
false
),
UseHugeTLBFS
(
false
),
UseSHM
(
false
));
// Using UseLargePages will default to UseHugeTLBFS large pages.
new
FlagTester
()
.
use
(
UseLargePages
(
true
))
.
expect
(
UseLargePages
(
true
),
UseTransparentHugePages
(
false
),
UseHugeTLBFS
(
true
),
UseSHM
(
false
));
}
public
static
void
testUseSHM
()
throws
Exception
{
if
(!
canUse
(
UseSHM
(
true
)))
{
System
.
out
.
println
(
"Skipping testUseSHM"
);
return
;
}
// -XX:-UseLargePages overrides all other flags.
new
FlagTester
()
.
use
(
UseLargePages
(
false
),
UseSHM
(
true
))
.
expect
(
UseLargePages
(
false
),
UseTransparentHugePages
(
false
),
UseHugeTLBFS
(
false
),
UseSHM
(
false
));
// Explicitly turn on UseSHM.
new
FlagTester
()
.
use
(
UseSHM
(
true
))
.
expect
(
UseLargePages
(
true
),
UseTransparentHugePages
(
false
),
UseHugeTLBFS
(
false
),
UseSHM
(
true
))
;
new
FlagTester
()
.
use
(
UseLargePages
(
true
),
UseSHM
(
true
))
.
expect
(
UseLargePages
(
true
),
UseTransparentHugePages
(
false
),
UseHugeTLBFS
(
false
),
UseSHM
(
true
))
;
// Setting a specific large pages flag will turn
// off heuristics to choose large pages type.
new
FlagTester
()
.
use
(
UseLargePages
(
true
),
UseSHM
(
false
))
.
expect
(
UseLargePages
(
false
),
UseTransparentHugePages
(
false
),
UseHugeTLBFS
(
false
),
UseSHM
(
false
));
// Setting UseLargePages can allow the system to choose
// UseHugeTLBFS instead of UseSHM, but never UseTransparentHugePages.
new
FlagTester
()
.
use
(
UseLargePages
(
true
))
.
expect
(
UseLargePages
(
true
),
UseTransparentHugePages
(
false
));
}
public
static
void
testCombinations
()
throws
Exception
{
if
(!
canUse
(
UseSHM
(
true
))
||
!
canUse
(
UseHugeTLBFS
(
true
)))
{
System
.
out
.
println
(
"Skipping testUseHugeTLBFSAndUseSHMCombination"
);
return
;
}
// UseHugeTLBFS takes precedence over SHM.
new
FlagTester
()
.
use
(
UseLargePages
(
true
),
UseHugeTLBFS
(
true
),
UseSHM
(
true
))
.
expect
(
UseLargePages
(
true
),
UseTransparentHugePages
(
false
),
UseHugeTLBFS
(
true
),
UseSHM
(
false
));
new
FlagTester
()
.
use
(
UseLargePages
(
true
),
UseHugeTLBFS
(
false
),
UseSHM
(
true
))
.
expect
(
UseLargePages
(
true
),
UseTransparentHugePages
(
false
),
UseHugeTLBFS
(
false
),
UseSHM
(
true
));
new
FlagTester
()
.
use
(
UseLargePages
(
true
),
UseHugeTLBFS
(
true
),
UseSHM
(
false
))
.
expect
(
UseLargePages
(
true
),
UseTransparentHugePages
(
false
),
UseHugeTLBFS
(
true
),
UseSHM
(
false
));
new
FlagTester
()
.
use
(
UseLargePages
(
true
),
UseHugeTLBFS
(
false
),
UseSHM
(
false
))
.
expect
(
UseLargePages
(
false
),
UseTransparentHugePages
(
false
),
UseHugeTLBFS
(
false
),
UseSHM
(
false
));
if
(!
canUse
(
UseTransparentHugePages
(
true
)))
{
return
;
}
// UseTransparentHugePages takes precedence.
new
FlagTester
()
.
use
(
UseLargePages
(
true
),
UseTransparentHugePages
(
true
),
UseHugeTLBFS
(
true
),
UseSHM
(
true
))
.
expect
(
UseLargePages
(
true
),
UseTransparentHugePages
(
true
),
UseHugeTLBFS
(
false
),
UseSHM
(
false
));
new
FlagTester
()
.
use
(
UseTransparentHugePages
(
true
),
UseHugeTLBFS
(
true
),
UseSHM
(
true
))
.
expect
(
UseLargePages
(
true
),
UseTransparentHugePages
(
true
),
UseHugeTLBFS
(
false
),
UseSHM
(
false
));
}
private
static
class
FlagTester
{
private
Flag
[]
useFlags
;
public
FlagTester
use
(
Flag
...
useFlags
)
{
this
.
useFlags
=
useFlags
;
return
this
;
}
public
void
expect
(
Flag
...
expectedFlags
)
throws
Exception
{
if
(
useFlags
==
null
)
{
throw
new
IllegalStateException
(
"Must run use() before expect()"
);
}
OutputAnalyzer
output
=
executeNewJVM
(
useFlags
);
for
(
Flag
flag
:
expectedFlags
)
{
System
.
out
.
println
(
"Looking for: "
+
flag
.
flagString
());
String
strValue
=
output
.
firstMatch
(
".* "
+
flag
.
name
()
+
" .* :?= (\\S+).*"
,
1
);
if
(
strValue
==
null
)
{
throw
new
RuntimeException
(
"Flag "
+
flag
.
name
()
+
" couldn't be found"
);
}
if
(!
flag
.
value
().
equals
(
strValue
))
{
throw
new
RuntimeException
(
"Wrong value for: "
+
flag
.
name
()
+
" expected: "
+
flag
.
value
()
+
" got: "
+
strValue
);
}
}
output
.
shouldHaveExitValue
(
0
);
}
}
private
static
OutputAnalyzer
executeNewJVM
(
Flag
...
flags
)
throws
Exception
{
ArrayList
<
String
>
args
=
new
ArrayList
<>();
for
(
Flag
flag
:
flags
)
{
args
.
add
(
flag
.
flagString
());
}
args
.
add
(
"-XX:+PrintFlagsFinal"
);
args
.
add
(
"-version"
);
ProcessBuilder
pb
=
ProcessTools
.
createJavaProcessBuilder
(
args
.
toArray
(
new
String
[
args
.
size
()]));
OutputAnalyzer
output
=
new
OutputAnalyzer
(
pb
.
start
());
return
output
;
}
private
static
boolean
canUse
(
Flag
flag
)
{
try
{
new
FlagTester
().
use
(
flag
).
expect
(
flag
);
}
catch
(
Exception
e
)
{
return
false
;
}
return
true
;
}
private
static
Flag
UseLargePages
(
boolean
value
)
{
return
new
BooleanFlag
(
"UseLargePages"
,
value
);
}
private
static
Flag
UseTransparentHugePages
(
boolean
value
)
{
return
new
BooleanFlag
(
"UseTransparentHugePages"
,
value
);
}
private
static
Flag
UseHugeTLBFS
(
boolean
value
)
{
return
new
BooleanFlag
(
"UseHugeTLBFS"
,
value
);
}
private
static
Flag
UseSHM
(
boolean
value
)
{
return
new
BooleanFlag
(
"UseSHM"
,
value
);
}
private
static
class
BooleanFlag
implements
Flag
{
private
String
name
;
private
boolean
value
;
BooleanFlag
(
String
name
,
boolean
value
)
{
this
.
name
=
name
;
this
.
value
=
value
;
}
public
String
flagString
()
{
return
"-XX:"
+
(
value
?
"+"
:
"-"
)
+
name
;
}
public
String
name
()
{
return
name
;
}
public
String
value
()
{
return
Boolean
.
toString
(
value
);
}
}
private
static
interface
Flag
{
public
String
flagString
();
public
String
name
();
public
String
value
();
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录