[MLton-devel] GC problem

Stephen Weeks MLton@mlton.org
Tue, 13 Aug 2002 21:58:07 -0700


--U5Qh2g1NYT
Content-Type: text/plain; charset=us-ascii
Content-Description: message body text
Content-Transfer-Encoding: 7bit


> 1) I downloaded version 20020728 which I patched with the latest
> version of resizeHeap() as recommended by Stephen.

I think it would be better to back port just the copy loop that
incrementally shrinks the heap, not the entire resizeHeap function, as
I will explain below.
 
> It compiles OK and runs reasonably at first, except that munmap
> failures occur during recompilation with itself (bootstrap). These
> failures are flagged with the EINVAL errno, which occurs because
> the size passed to munmap is sometimes not a multiple of pagesize.
> 
> I turned on debugging and got confirmation of the problem.
> 
> gc.c 976: assert(isPageAligned (s, keep)) failed.
> 
> A first source seems to lie in the fact that the computation of
> KEEP in RESIZEHEAP is not necessarily followed by a ROUNDPAGE.

In revision 1.69 of gc.c, which is where I added the copy loop, the
heapShrink routine does *not* have as a precondition that the keep is
page aligned -- heapShrink does the alignment itself.  So, in 1.69,
the copy loop looks like

copy:			
			from -= COPY_CHUNK_SIZE;
			to -= COPY_CHUNK_SIZE;
			if (from > old) {
				copy (from, to, COPY_CHUNK_SIZE);
				heapShrink (s, &s->heap, from - old);
				goto copy;
			}

On the other hand, in revision 1.66 of gc.c, heapShrink does have the
following precondition:

	assert (isPageAligned (s, keep));

So, the right way to back port the copy loop to revision 1.66 is to
change it to

copy:			
			from -= COPY_CHUNK_SIZE;
			to -= COPY_CHUNK_SIZE;
			if (from > old) {
				copy (from, to, COPY_CHUNK_SIZE);
				heapShrink (s, &s->heap, roundPage (s, from - old));
				goto copy;
			}

> A second source of non aligned arguments to munmap seems to reside
> in the fact that the SIZE in the else branch of the "if (not
> grow)" conditional is not necessarily a multiple of pagesize as it
> is ultimately defined as a number of live bytes. Is there here
> also a need to a ROUNDPAGE ?

This is not a bug in revision 1.69 because in that revision, none of
the calls to shrinkFromSpace do the roundPage because the
preconditions of shrinkFromSpace no longer require it.  But, if you
try to backport the entire resizeHeap function to 1.66, then you do
need to make sure the alignment precondition is met.  Because of this,
I would prefer not to backport the entire resizeHeap function from
1.69 to 1.66.  I think it is easier to just back port the copy loop as
I have shown above.

> Enclosed is the gc.c file containing these two modifications (bug
> fix + new criterion) on top of rev. 1.66 + resizeHeap() from 1.68.

I've attached an alternate patch to revision 1.66 that does what I
describe above, and also makes a change to unpack necessary to work
with the copy loop.  This version passes the regressions and a self
compiles.

> 2) In the Sansom 1991 article on GC, I understand that they
> recommend as a criterion for switching from stop-and-copy to
> mark-compact live_ratio >= 0.3 * maxheap (where 0.3 is the r*
> ratio from the article). I tried this in doGc, and did as a
> benchmark a self compile of mlton. I got the following:
> 
> GC time  GC%
> 107.5s   35% (22 copy, 42 compact)
> 24.8s    16% (47 copy, 0 compact) 

Just to be sure, is the first row the result of a self-compile using
the old criterion and the second row using the new criterion?  That's
quite an improvement.  What is the RAM size of the machine?  Also, are
these user + sys times or elapsed?  One thing to be careful of when
considering improvements in paging situations is that paging costs do
not get counted in user + sys, so it's important to look at elapsed
time too.

> It is true that previous switching criterion is safer in that it
> will avoid swapping more strictly. However in practice I think
> that often only parts of fromSpace are paged in.

As long as from space is smaller than the RAM size, this doesn't make
sense to me.  I would think that all of fromSpace would be in RAM,
since the gc scans through the first part in doing the copy and the
mutator scans through the rest when allocating at the frontier.  Can
anyone see where I am confused?

My general feeling is that swapping is so costly that I like to err on
the side of avoiding it.  But your numbers are hard to disagree with.


--U5Qh2g1NYT
Content-Type: application/octet-stream
Content-Description: gc.c
Content-Disposition: attachment;
	filename="gc.c"
Content-Transfer-Encoding: base64

LyogQ29weXJpZ2h0IChDKSAxOTk5LTIwMDIgSGVucnkgQ2VqdGluLCBNYXR0aGV3IEZsdWV0
LCBTdXJlc2gKICogICAgSmFnYW5uYXRoYW4sIGFuZCBTdGVwaGVuIFdlZWtzLgogKiBDb3B5
cmlnaHQgKEMpIDE5OTctMTk5OSBORUMgUmVzZWFyY2ggSW5zdGl0dXRlLgogKgogKiBNTHRv
biBpcyByZWxlYXNlZCB1bmRlci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ICAg
ICBGSUxFICpmaWxlOwogICAgICAgIGludCB0b3RhbF9zaXplID0gMDsKCiAgICAgICAgZmls
ZSA9IHBvcGVuKCIvdXNyL3NiaW4vc3dhcGluZm8gLWsgfCBhd2sgJ3sgcHJpbnQgJDQ7IH0n
XG4iLCAiciIpOwogICAgICAgIGlmIChmaWxlID09IE5VTEwpIAogICAgICAgICAgICAgICAg
ZGllZSgic3dhcGluZm8gZmFpbGVkIik7CgogICAgICAgIC8qIHNraXAgaGVhZGVyICovCiAg
ICAgICAgZmdldHMoYnVmZmVyLCAyNTUsIGZpbGUpOwoKICAgICAgICB3aGlsZSAoZmdldHMo
YnVmZmVyLCAyNTUsIGZpbGUpICE9IE5VTEwpIHsgCiAgICAgICAgICAgICAgICB0b3RhbF9z
aXplICs9IGF0b2koYnVmZmVyKTsKICAgICAgICB9CgogICAgICAgIHBjbG9zZShmaWxlKTsK
CiAgICAgICAgcmV0dXJuIHRvdGFsX3NpemUgKiAxMDI0Owp9CgovKiByZXR1cm5zIHRvdGFs
IGFtb3VudCBvZiBtZW1vcnkgYXZhaWxhYmxlICovCnN0YXRpYyBpbnQgCmdldF90b3RhbF9t
ZW0oKSAKewogICAgICAgIHN0YXRpYyBjaGFyIGJ1ZmZlclsyNTZdOwogICAgICAgIEZJTEUg
KmZpbGU7CiAgICAgICAgaW50IHRvdGFsX3NpemUgPSAwOwoKICAgICAgICBmaWxlID0gcG9w
ZW4oIi9zYmluL3N5c2N0bCBody5waHlzbWVtIHwgYXdrICd7IHByaW50ICQyOyB9J1xuIiwg
InIiKTsKICAgICAgICBpZiAoZmlsZSA9PSBOVUxMKSAKICAgICAgICAgICAgICAgIGRpZWUo
InN5c2N0bCBmYWlsZWQiKTsKCgogICAgICAgIGZnZXRzKGJ1ZmZlciwgMjU1LCBmaWxlKTsK
CiAgICAgICAgcGNsb3NlKGZpbGUpOwoKICAgICAgICByZXR1cm4gYXRvaShidWZmZXIpOwp9
CgpzdGF0aWMgaW5saW5lIHZvaWQg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CBoZWFwIHRvIHNpemUgJXMuXG4iLAoJCQkJdWludFRv
Q29tbWFTdHJpbmcgKHMtPmhlYXAuc2l6ZSkpOwoJbGVhdmUgKHMpOwp9Cgp2b2lkIEdDX3Vu
cGFjayAoR0Nfc3RhdGUgcykgewoJZW50ZXIgKHMpOwoJaWYgKERFQlVHIG9yIHMtPm1lc3Nh
Z2VzKQoJCWZwcmludGYgKHN0ZGVyciwgIlVucGFja2luZyBoZWFwIG9mIHNpemUgJXMuXG4i
LAoJCQkJdWludFRvQ29tbWFTdHJpbmcgKHMtPmhlYXAuc2l6ZSkpOwoJcy0+Ynl0ZXNMaXZl
ID0gcy0+ZnJvbnRpZXIgLSBzLT5oZWFwLm9sZEdlbjsKCXNldE51cnNlcnkgKHMpOwoJcmVz
aXplSGVhcCAocywgcy0+Ynl0ZXNMaXZlKTsKCWlmIChERUJVRyBvciBzLT5tZXNzYWdlcykK
CQlmcHJpbnRmIChzdGRlcnIsICJVbnBhY2tlZCBoZWFwIG9mIHNpemUgJXMuXG4iLAoJCQkJ
dWludFRvQ29tbWFTdHJpbmcgKHMtPmhlYXAuc2l6ZSkpOwoJbGVhdmUgKHMpOwp9Cg==
--U5Qh2g1NYT--


-------------------------------------------------------
This sf.net email is sponsored by: Dice - The leading online job board
for high-tech professionals. Search and apply for tech jobs today!
http://seeker.dice.com/seeker.epl?rel_code=31
_______________________________________________
MLton-devel mailing list
MLton-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mlton-devel