<html>
<head>
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<br>
<br>
<div class="moz-cite-prefix">On 9/10/2015 3:54 AM, Galkin, Ivan
wrote:<br>
</div>
<blockquote
cite="mid:8F4410BA1F99FD46B6A158A59E8585CD696DDC0D@DEWDFEMB11B.global.corp.sap"
type="cite">
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1252">
<meta name="Generator" content="Microsoft Word 14 (filtered
medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:Wingdings;
panose-1:5 0 0 0 0 0 0 0 0 0;}
@font-face
{font-family:Wingdings;
panose-1:5 0 0 0 0 0 0 0 0 0;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:Tahoma;
panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri","sans-serif";
color:black;
mso-fareast-language:EN-US;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
{mso-style-priority:34;
margin-top:0cm;
margin-right:0cm;
margin-bottom:0cm;
margin-left:36.0pt;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri","sans-serif";
color:black;
mso-fareast-language:EN-US;}
span.EmailStyle18
{mso-style-type:personal;
font-family:"Calibri","sans-serif";
color:windowtext;}
span.EmailStyle19
{mso-style-type:personal;
font-family:"Calibri","sans-serif";
color:#1F497D;}
span.EmailStyle20
{mso-style-type:personal-reply;
font-family:"Calibri","sans-serif";
color:#1F497D;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:70.85pt 70.85pt 2.0cm 70.85pt;}
div.WordSection1
{page:WordSection1;}
/* List Definitions */
@list l0
{mso-list-id:650062728;
mso-list-type:hybrid;
mso-list-template-ids:-838587348 1128288572 134807555 134807557 134807553 134807555 134807557 134807553 134807555 134807557;}
@list l0:level1
{mso-level-start-at:0;
mso-level-number-format:bullet;
mso-level-text:\F0B7;
mso-level-tab-stop:none;
mso-level-number-position:left;
margin-left:54.0pt;
text-indent:-18.0pt;
font-family:Symbol;
mso-fareast-font-family:Calibri;
mso-bidi-font-family:"Times New Roman";}
@list l0:level2
{mso-level-number-format:bullet;
mso-level-text:o;
mso-level-tab-stop:none;
mso-level-number-position:left;
margin-left:90.0pt;
text-indent:-18.0pt;
font-family:"Courier New";}
@list l0:level3
{mso-level-number-format:bullet;
mso-level-text:\F0A7;
mso-level-tab-stop:none;
mso-level-number-position:left;
margin-left:126.0pt;
text-indent:-18.0pt;
font-family:Wingdings;}
@list l0:level4
{mso-level-number-format:bullet;
mso-level-text:\F0B7;
mso-level-tab-stop:none;
mso-level-number-position:left;
margin-left:162.0pt;
text-indent:-18.0pt;
font-family:Symbol;}
@list l0:level5
{mso-level-number-format:bullet;
mso-level-text:o;
mso-level-tab-stop:none;
mso-level-number-position:left;
margin-left:198.0pt;
text-indent:-18.0pt;
font-family:"Courier New";}
@list l0:level6
{mso-level-number-format:bullet;
mso-level-text:\F0A7;
mso-level-tab-stop:none;
mso-level-number-position:left;
margin-left:234.0pt;
text-indent:-18.0pt;
font-family:Wingdings;}
@list l0:level7
{mso-level-number-format:bullet;
mso-level-text:\F0B7;
mso-level-tab-stop:none;
mso-level-number-position:left;
margin-left:270.0pt;
text-indent:-18.0pt;
font-family:Symbol;}
@list l0:level8
{mso-level-number-format:bullet;
mso-level-text:o;
mso-level-tab-stop:none;
mso-level-number-position:left;
margin-left:306.0pt;
text-indent:-18.0pt;
font-family:"Courier New";}
@list l0:level9
{mso-level-number-format:bullet;
mso-level-text:\F0A7;
mso-level-tab-stop:none;
mso-level-number-position:left;
margin-left:342.0pt;
text-indent:-18.0pt;
font-family:Wingdings;}
@list l1
{mso-list-id:930966516;
mso-list-type:hybrid;
mso-list-template-ids:-1851771562 -311100794 134807555 134807557 134807553 134807555 134807557 134807553 134807555 134807557;}
@list l1:level1
{mso-level-start-at:0;
mso-level-number-format:bullet;
mso-level-text:\F0B7;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Symbol;
mso-fareast-font-family:Calibri;
mso-bidi-font-family:"Times New Roman";}
@list l1:level2
{mso-level-number-format:bullet;
mso-level-text:o;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:"Courier New";}
@list l1:level3
{mso-level-number-format:bullet;
mso-level-text:\F0A7;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Wingdings;}
@list l1:level4
{mso-level-number-format:bullet;
mso-level-text:\F0B7;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Symbol;}
@list l1:level5
{mso-level-number-format:bullet;
mso-level-text:o;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:"Courier New";}
@list l1:level6
{mso-level-number-format:bullet;
mso-level-text:\F0A7;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Wingdings;}
@list l1:level7
{mso-level-number-format:bullet;
mso-level-text:\F0B7;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Symbol;}
@list l1:level8
{mso-level-number-format:bullet;
mso-level-text:o;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:"Courier New";}
@list l1:level9
{mso-level-number-format:bullet;
mso-level-text:\F0A7;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Wingdings;}
@list l2
{mso-list-id:980844461;
mso-list-type:hybrid;
mso-list-template-ids:2091041230 134807567 134807577 134807579 134807567 134807577 134807579 134807567 134807577 134807579;}
@list l2:level1
{mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;}
@list l2:level2
{mso-level-number-format:alpha-lower;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;}
@list l2:level3
{mso-level-number-format:roman-lower;
mso-level-tab-stop:none;
mso-level-number-position:right;
text-indent:-9.0pt;}
@list l2:level4
{mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;}
@list l2:level5
{mso-level-number-format:alpha-lower;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;}
@list l2:level6
{mso-level-number-format:roman-lower;
mso-level-tab-stop:none;
mso-level-number-position:right;
text-indent:-9.0pt;}
@list l2:level7
{mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;}
@list l2:level8
{mso-level-number-format:alpha-lower;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;}
@list l2:level9
{mso-level-number-format:roman-lower;
mso-level-tab-stop:none;
mso-level-number-position:right;
text-indent:-9.0pt;}
@list l3
{mso-list-id:1226531328;
mso-list-type:hybrid;
mso-list-template-ids:-688127014 134807553 134807555 134807557 134807553 134807555 134807557 134807553 134807555 134807557;}
@list l3:level1
{mso-level-number-format:bullet;
mso-level-text:\F0B7;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Symbol;}
@list l3:level2
{mso-level-number-format:bullet;
mso-level-text:o;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:"Courier New";}
@list l3:level3
{mso-level-number-format:bullet;
mso-level-text:\F0A7;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Wingdings;}
@list l3:level4
{mso-level-number-format:bullet;
mso-level-text:\F0B7;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Symbol;}
@list l3:level5
{mso-level-number-format:bullet;
mso-level-text:o;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:"Courier New";}
@list l3:level6
{mso-level-number-format:bullet;
mso-level-text:\F0A7;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Wingdings;}
@list l3:level7
{mso-level-number-format:bullet;
mso-level-text:\F0B7;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Symbol;}
@list l3:level8
{mso-level-number-format:bullet;
mso-level-text:o;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:"Courier New";}
@list l3:level9
{mso-level-number-format:bullet;
mso-level-text:\F0A7;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Wingdings;}
@list l4
{mso-list-id:1578007347;
mso-list-type:hybrid;
mso-list-template-ids:-1325343380 1108241774 134807555 134807557 134807553 134807555 134807557 134807553 134807555 134807557;}
@list l4:level1
{mso-level-start-at:0;
mso-level-number-format:bullet;
mso-level-text:\F0B7;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Symbol;
mso-fareast-font-family:Calibri;
mso-bidi-font-family:"Times New Roman";}
@list l4:level2
{mso-level-number-format:bullet;
mso-level-text:o;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:"Courier New";}
@list l4:level3
{mso-level-number-format:bullet;
mso-level-text:\F0A7;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Wingdings;}
@list l4:level4
{mso-level-number-format:bullet;
mso-level-text:\F0B7;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Symbol;}
@list l4:level5
{mso-level-number-format:bullet;
mso-level-text:o;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:"Courier New";}
@list l4:level6
{mso-level-number-format:bullet;
mso-level-text:\F0A7;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Wingdings;}
@list l4:level7
{mso-level-number-format:bullet;
mso-level-text:\F0B7;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Symbol;}
@list l4:level8
{mso-level-number-format:bullet;
mso-level-text:o;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:"Courier New";}
@list l4:level9
{mso-level-number-format:bullet;
mso-level-text:\F0A7;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Wingdings;}
ol
{margin-bottom:0cm;}
ul
{margin-bottom:0cm;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
<div class="WordSection1">
<p class="MsoNormal"><span style="color:#1F497D">Hello Jon,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">thank you for
your review and your support.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">Besides CMS the
function check_gc_overhead_limit() is called only in
PSMarkSweep, PSParallelCompact and PSScavenge:<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">* PSMarkSweep,
PSParallelCompact use the formula “young_gen->max_size()
- young_gen->from_space()->capacity_in_bytes() -
young_gen->to_space()->capacity_in_bytes()”, which is
correct because PSYoungGen::max_size() == “size in bytes
reserved for young generation”<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">* PSScavenge
use a similar calculation, however both max_young_size and
survivor_limit are recalculated because of MinHeapFreeRation
& MaxHeapFreeRatio<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">// START
SNIPPET FROM PSScavenge::invoke_no_policy(), see
hotspot/src/share/vm/gc/parallel/psScavenge.cpp<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"> size_t
max_young_size = young_gen->max_size();<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"> ...<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"> if
(MinHeapFreeRatio != 0 || MaxHeapFreeRatio != 100) {<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">
max_young_size = MIN2(old_gen->capacity_in_bytes() /
NewRatio, young_gen->max_size());<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"> }<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"> ...<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"> size_t
<b>survivor_limit</b> =<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">
size_policy->max_survivor_size(max_young_size);<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"> ...<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">
assert(<b>young_gen->max_size()</b> ><o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">
young_gen->from_space()->capacity_in_bytes() +<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">
young_gen->to_space()->capacity_in_bytes(),<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">
"Sizes of space in young gen are out-of-bounds");</span></p>
</div>
</blockquote>
<br>
This is a bit curious although the way the survivor spaces<br>
grow and shrink with ParallelGC, I can imagine that it is<br>
there to catch really bad calculations of the survivor<br>
sizes. If the survivors grow larger than the current<br>
eden size, it is not necessarily a bug, it's just not<br>
useful (part of the survivor space would just never<br>
be used). It's a fuzzy assertion but a safe one.<br>
See my comment below on your alternative.<br>
<blockquote
cite="mid:8F4410BA1F99FD46B6A158A59E8585CD696DDC0D@DEWDFEMB11B.global.corp.sap"
type="cite">
<div class="WordSection1">
<p class="MsoNormal"><span style="color:#1F497D"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"> ...<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">
size_t max_eden_size =
<b>max_young_size</b> -<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">
young_gen->from_space()->capacity_in_bytes() -<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">
young_gen->to_space()->capacity_in_bytes();</span></p>
</div>
</blockquote>
<br>
The survivor spaces can grow small (in principle down to<br>
1 page) so I don't think survivor limit (which is their maximum<br>
size relative to some young gen size) would give a maximum<br>
eden size.<br>
<br>
<blockquote
cite="mid:8F4410BA1F99FD46B6A158A59E8585CD696DDC0D@DEWDFEMB11B.global.corp.sap"
type="cite">
<div class="WordSection1">
<p class="MsoNormal"><span style="color:#1F497D"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">// END SNIPPET
FROM PSScavenge::invoke_no_policy()<o:p></o:p></span></p>
<p class="MsoNormal" style="text-indent:36.0pt"><span
style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal" style="text-indent:36.0pt"><span
style="color:#1F497D">I’m not ably to say if there is an
error in the calculation of max_eden_size, however I’m
wondering a) why recalculated survivor_limit is not used and
b) what is the marked assertion good for?<o:p></o:p></span></p>
<p class="MsoNormal" style="text-indent:36.0pt"><span
style="color:#1F497D">In my opinion the calculation should
look as following. I didn’t test the change. It’s only
deduced, so every comment would be welcome.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">diff -r
f74b3ce62e1f src/share/vm/gc/parallel/psScavenge.cpp<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">---
a/src/share/vm/gc/parallel/psScavenge.cpp Fri Sep 04
17:33:56 2015 -0700<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">+++
b/src/share/vm/gc/parallel/psScavenge.cpp Thu
Sep 10 12:30:19 2015 +0200<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">@@ -560,18
+560,14 @@<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"> if
(UseAdaptiveGenerationSizePolicyAtMinorCollection &&<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">
(AdaptiveSizePolicy::should_update_eden_stats(gc_cause))) {<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"> //
Calculate optimal free space amounts<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">-
assert(young_gen->max_size() ><o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">-
young_gen->from_space()->capacity_in_bytes() +<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">-
young_gen->to_space()->capacity_in_bytes(),<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">+
assert(max_young_size > 2 * survivor_limit,</span></p>
</div>
</blockquote>
<br>
survivor_limit is calculated based on max_young_size<br>
<br>
535 size_t survivor_limit =<br>
536 size_policy->max_survivor_size(max_young_size);<br>
<br>
so "max_young_size > 2*survivor_limit" shouldn't fail<br>
unless MinSurvivorRatio is broken. Do you agree?<br>
<br>
I'd be willing to delete the assertion if you like. <br>
<br>
Jon<br>
<br>
<blockquote
cite="mid:8F4410BA1F99FD46B6A158A59E8585CD696DDC0D@DEWDFEMB11B.global.corp.sap"
type="cite">
<div class="WordSection1">
<p class="MsoNormal"><span style="color:#1F497D"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">
"Sizes of space in young gen are out-of-bounds");<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"> size_t
young_live = young_gen->used_in_bytes();<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">
size_t eden_live =
young_gen->eden_space()->used_in_bytes();<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">
size_t cur_eden =
young_gen->eden_space()->capacity_in_bytes();<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">
size_t max_old_gen_size = old_gen->max_gen_size();<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">-
size_t max_eden_size = max_young_size -<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">-
young_gen->from_space()->capacity_in_bytes() -<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">-
young_gen->to_space()->capacity_in_bytes();<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">+
size_t max_eden_size = max_young_size - 2 * survivor_limit;<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"> //
Used for diagnostics<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">
size_policy->clear_generation_free_space_flags();<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">Best regard,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">Ivan<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">P.S. Your
questions about contributor agreement and a bug report were
answered by my colleague Volker Simonis<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">
<o:p>
</o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div style="border:none;border-top:solid #B5C4DF
1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><span
style="font-size:10.0pt;font-family:"Tahoma","sans-serif";color:windowtext;mso-fareast-language:EN-GB"
lang="EN-US">From:</span></b><span
style="font-size:10.0pt;font-family:"Tahoma","sans-serif";color:windowtext;mso-fareast-language:EN-GB"
lang="EN-US"> hotspot-gc-dev
[<a class="moz-txt-link-freetext" href="mailto:hotspot-gc-dev-bounces@openjdk.java.net">mailto:hotspot-gc-dev-bounces@openjdk.java.net</a>] <b>On
Behalf Of </b>
Jon Masamitsu<br>
<b>Sent:</b> Mittwoch, 9. September 2015 18:22<br>
<b>To:</b> <a class="moz-txt-link-abbreviated" href="mailto:hotspot-gc-dev@openjdk.java.net">hotspot-gc-dev@openjdk.java.net</a><br>
<b>Subject:</b> Re: CMS: wrong max_eden_size for
check_gc_overhead_limit<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal" style="margin-bottom:12.0pt">Ivan,<br>
<br>
You're correct about this bug.<br>
<br>
Is it correct that you're covered by the SAP contributor<br>
agreement?<br>
<br>
Have you filed a bug report on this?<br>
<br>
Have you checked the other GC's for this problem?<br>
<br>
I can sponsor this fix.<br>
<br>
Thanks.<br>
<br>
Jon<br>
<br>
<br>
<o:p></o:p></p>
<div>
<p class="MsoNormal">On 9/8/2015 2:21 AM, Galkin, Ivan wrote:<o:p></o:p></p>
</div>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p class="MsoNormal">Hello all,<o:p></o:p></p>
<p class="MsoNormal"> <o:p></o:p></p>
<p class="MsoNormal">I believe the calculation of
max_eden_size which is needed to check the GC overhead in
CMS is incorrect. Namely in
concurrentMarkSweepGeneration.cpp the following expression
is used:<o:p></o:p></p>
<p class="MsoNormal"> <o:p></o:p></p>
<p class="MsoNormal" style="text-indent:36.0pt">size_t
max_eden_size = _young_gen->max_capacity() -
_young_gen->to()->capacity() -
_young_gen->from()->capacity();<o:p></o:p></p>
<p class="MsoNormal"> <o:p></o:p></p>
<p class="MsoNormal">According to the implementation of
DefNewGeneration::max_capacity() the expression can be
unfolded as:<o:p></o:p></p>
<p class="MsoNormal"> <o:p></o:p></p>
<p class="MsoNormal"> size_t max_eden_size =
(“reserved size of young gen” – “size of survivor space”) –
“size of survivor space” – “size of survivor space”;<o:p></o:p></p>
<p class="MsoNormal"> <o:p></o:p></p>
<p class="MsoNormal">So the value becomes too small (survival
spaces are accounted 3 times!), which can lead to the
following problems:<o:p></o:p></p>
<p class="MsoNormal"> <o:p></o:p></p>
<p class="MsoListParagraph"
style="text-indent:-18.0pt;mso-list:l2 level1 lfo2"><!--[if !supportLists]--><span
style="mso-list:Ignore">1.<span style="font:7.0pt
"Times New Roman"">
</span></span><!--[endif]-->max_eden_size is too small and
GC overhead is wrongfully recognized too early<o:p></o:p></p>
<p class="MsoListParagraph"
style="text-indent:-18.0pt;mso-list:l2 level1 lfo2"><!--[if !supportLists]--><span
style="mso-list:Ignore">2.<span style="font:7.0pt
"Times New Roman"">
</span></span><!--[endif]-->max_eden_size == 0 (all young
spaces have the same size; -XX:SurvivorRatio=1) and GC
overhead is never happens (see implementation of
AdaptiveSizePolicy::check_gc_overhead_limit:
<o:p></o:p></p>
<p class="MsoListParagraph"
style="margin-left:72.0pt;text-indent:-18.0pt;mso-list:l2
level2 lfo2">
<!--[if !supportLists]--><span style="mso-list:Ignore">a.<span
style="font:7.0pt "Times New Roman"">
</span></span><!--[endif]-->max_eden_size == 0 leads to
mem_free_eden_limit == 0; <o:p>
</o:p></p>
<p class="MsoListParagraph"
style="margin-left:72.0pt;text-indent:-18.0pt;mso-list:l2
level2 lfo2">
<!--[if !supportLists]--><span style="mso-list:Ignore">b.<span
style="font:7.0pt "Times New Roman"">
</span></span><!--[endif]-->free_in_eden <
mem_free_eden_limit is always false, since both are unsigned
integers and mem_free_eden_limit is 0)<o:p></o:p></p>
<p class="MsoNormal"> <o:p></o:p></p>
<p class="MsoNormal">I would therefore suggest the following
fix (DefNewGeneration:: max_eden_size() already contains the
correctly calculated capacity of eden):<o:p></o:p></p>
<p class="MsoNormal"> <o:p></o:p></p>
<p class="MsoNormal">diff -r f74b3ce62e1f
src/share/vm/gc/cms/concurrentMarkSweepGeneration.cpp<o:p></o:p></p>
<p class="MsoNormal">---
a/src/share/vm/gc/cms/concurrentMarkSweepGeneration.cpp
Fri Sep 04 17:33:56 2015 -0700<o:p></o:p></p>
<p class="MsoNormal">+++
b/src/share/vm/gc/cms/concurrentMarkSweepGeneration.cpp
Mon Sep 07 18:08:39 2015 +0200<o:p></o:p></p>
<p class="MsoNormal">@@ -1563,9 +1563,7 @@<o:p></o:p></p>
<p class="MsoNormal">
do_compaction_work(clear_all_soft_refs);<o:p></o:p></p>
<p class="MsoNormal"> <o:p></o:p></p>
<p class="MsoNormal"> // Has the GC time limit been
exceeded?<o:p></o:p></p>
<p class="MsoNormal">- size_t max_eden_size =
_young_gen->max_capacity() -<o:p></o:p></p>
<p class="MsoNormal">-
_young_gen->to()->capacity() -<o:p></o:p></p>
<p class="MsoNormal">-
_young_gen->from()->capacity();<o:p></o:p></p>
<p class="MsoNormal">+ size_t max_eden_size =
_young_gen->max_eden_size();<o:p></o:p></p>
<p class="MsoNormal"> GCCause::Cause gc_cause =
gch->gc_cause();<o:p></o:p></p>
<p class="MsoNormal">
size_policy()->check_gc_overhead_limit(_young_gen->used(),<o:p></o:p></p>
<p class="MsoNormal">
_young_gen->eden()->used(),<o:p></o:p></p>
<p class="MsoNormal"> <o:p></o:p></p>
<p class="MsoNormal">Could anybody please review and sponsor
the change?<o:p></o:p></p>
<p class="MsoNormal"> <o:p></o:p></p>
<p class="MsoNormal">Thank you in advance,<o:p></o:p></p>
<p class="MsoNormal">Ivan<o:p></o:p></p>
</blockquote>
<p class="MsoNormal"><span
style="font-size:12.0pt;font-family:"Times New
Roman","serif";mso-fareast-language:EN-GB"><o:p> </o:p></span></p>
</div>
</blockquote>
<br>
</body>
</html>