<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Ramki,<br>
<br>
Do you remember if there was originally a call to<br>
do_collection() in the CMS do_compaction_work()?<br>
It currently has a call to GenMarkSweep::invoke_at_safepoint()<br>
to do the collection.<br>
<br>
For shrinking the CMS generation I had in mind looking<br>
at the free chunk at the end of the generation and shrinking<br>
the generation according to policy (the FreeRatio's) and<br>
the size of that free chunk. After a mark-sweep-compact<br>
the free chunk at the end of the generation would be<br>
everything free. So in this case the current interfaces<br>
would work if CMS::compute_new_size() were just<br>
called at the end of do_compaction_work(). And if<br>
CMS::compute_new_size() were fixed. Do you believe?<br>
<br>
Jon<br>
<br>
<br>
On 05/10/12 23:05, Srinivas Ramakrishna wrote:
<blockquote
cite="mid:CABzyjymPspoXEJiqBT8FFaAFmHcX7EB=HnuCMsFxUsBJd3We8A@mail.gmail.com"
type="cite">Jon, Kris -- I agree that there is an easily fixed bug
here which could be fixed by (more or less) having the CMS
generation<br>
basically do after a stop-world collection what TenuredGeneration
does, modulo appropriate parameters<br>
(CMS needs more headroom etc. which are really different free
ratio defaults). Looks like the<br>
expansion/shrinking/resizing really belonged to a Policy class
which would take a generation<br>
as a parameter and resize it appropriately based on the state of
the generation and policy<br>
parameters (which could be obtained from the generation). That
would allow for sharing of<br>
the code without the kind of duplication that we have today with
small modifications at various<br>
places...<br>
<br>
-- ramki<br>
<br>
<div class="gmail_quote">On Thu, May 10, 2012 at 9:24 PM, Krystal
Mok <span dir="ltr"><<a moz-do-not-send="true"
href="mailto:rednaxelafx@gmail.com" target="_blank">rednaxelafx@gmail.com</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
<div class="gmail_quote">
<div class="im">On Fri, May 11, 2012 at 1:35 AM, Jon
Masamitsu <span dir="ltr"><<a moz-do-not-send="true"
href="mailto:jon.masamitsu@oracle.com" target="_blank">jon.masamitsu@oracle.com</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
<div><br>
Not quite. Damon was using System.gc() to try to
resize and System.gc() (not using the concurrent</div>
collection but the STW collection) uses the MarkSweep
code. That code can use the compute_new_size()<br>
and shrink the heap.<br>
<br>
</blockquote>
</div>
<div>Oops, should have made myself clearer.</div>
<div>I meant shrinking is part of the generational GC
framework's interface, but the implementation in CMS
generation is empty:</div>
<div><br>
</div>
<div>
<div><font face="'courier new', monospace">void
ConcurrentMarkSweepGeneration::shrink_by(size_t bytes)
{</font></div>
<div><font face="'courier new', monospace">
assert_locked_or_safepoint(Heap_lock);</font></div>
<div><font face="'courier new', monospace">
assert_lock_strong(freelistLock());</font></div>
<div><font face="'courier new', monospace"> // XXX Fix
when compaction is implemented.</font></div>
<div><font face="'courier new', monospace">
warning("Shrinking of CMS not yet implemented");</font></div>
<div><font face="'courier new', monospace"> return;</font></div>
<div><font face="'courier new', monospace">}</font></div>
</div>
<div><br>
</div>
<div>And ConcurrentMarkSweepGeneration::compute_new_size()
currently handles expansion but not shrinking.</div>
<div><br>
</div>
<div>So even if one were to resize the space at the end of a
STW full GC, the CMS old / perm gen still could handle
shrinking.</div>
<div>In fact, my original motivation to implement shrinking
in CMS (generation, not concurrent collection) was almost
the same as what Damon is asking for, that is to release
memory back to OS after a full GC.</div>
<div><br>
</div>
<div>- Kris</div>
<div>
<div class="h5">
<div> </div>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
You're right about the CompactibleFreeListSpace used
by CMS where the free space is on<br>
a free list. Live objects at the end of the
generation make it impossible to shrink the<br>
generation.<span><font color="#888888"><br>
<br>
Jon</font></span>
<div>
<div><br>
<blockquote class="gmail_quote" style="margin:0 0
0 .8ex;border-left:1px #ccc
solid;padding-left:1ex">
- Kris<br>
<br>
On Fri, May 11, 2012 at 12:31 AM, Jon
Masamitsu<<a moz-do-not-send="true"
href="mailto:jon.masamitsu@oracle.com"
target="_blank">jon.masamitsu@oracle.com</a>>wrote:<br>
<br>
<blockquote class="gmail_quote" style="margin:0
0 0 .8ex;border-left:1px #ccc
solid;padding-left:1ex">
Damon,<br>
<br>
From inspection of the code I think that CMS
does not do a<br>
resizing of the heap after it does a
System.gc(). That resizing<br>
would be the code that adjusts the generations
for<br>
MinHeapFreeRatio / MaxHeapFreeRatio and
returns<br>
memory to the OS.<br>
<br>
I've created CR 7167923 to investigate this
bug.<br>
<br>
Jon<br>
<br>
On 5/9/2012 2:34 AM, Damon Hart-Davis wrote:<br>
<blockquote class="gmail_quote"
style="margin:0 0 0 .8ex;border-left:1px
#ccc solid;padding-left:1ex">
Hi,<br>
<br>
No, because when I explicitly call
System.gc() I want it to try as hard<br>
</blockquote>
as it can, even to the point of stopping the
world...<br>
<blockquote class="gmail_quote"
style="margin:0 0 0 .8ex;border-left:1px
#ccc solid;padding-left:1ex">
Rgds<br>
<br>
Damon<br>
<br>
<br>
On 9 May 2012, at 10:27, Jon Masamitsu
wrote:<br>
<br>
<blockquote class="gmail_quote"
style="margin:0 0 0 .8ex;border-left:1px
#ccc solid;padding-left:1ex">
Damon,<br>
<br>
Do you turn on
ExplicitGCInvokesConcurrent?<br>
<br>
Jon<br>
<br>
</blockquote>
</blockquote>
_______________________________________________<br>
hotspot-gc-use mailing list<br>
<a moz-do-not-send="true"
href="mailto:hotspot-gc-use@openjdk.java.net"
target="_blank">hotspot-gc-use@openjdk.java.net</a><br>
<a moz-do-not-send="true"
href="http://mail.openjdk.java.net/mailman/listinfo/hotspot-gc-use"
target="_blank">http://mail.openjdk.java.net/mailman/listinfo/hotspot-gc-use</a><br>
<br>
</blockquote>
</blockquote>
</div>
</div>
</blockquote>
</div>
</div>
</div>
<br>
<br>
_______________________________________________<br>
hotspot-gc-use mailing list<br>
<a moz-do-not-send="true"
href="mailto:hotspot-gc-use@openjdk.java.net">hotspot-gc-use@openjdk.java.net</a><br>
<a moz-do-not-send="true"
href="http://mail.openjdk.java.net/mailman/listinfo/hotspot-gc-use"
target="_blank">http://mail.openjdk.java.net/mailman/listinfo/hotspot-gc-use</a><br>
<br>
</blockquote>
</div>
<br>
</blockquote>
</body>
</html>