Ravenbrook / mps

The Memory Pool System
http://www.ravenbrook.com/project/mps
Other
563 stars 77 forks source link

Unnecessary write barrier on white segments #130

Open rptb1 opened 1 year ago

rptb1 commented 1 year ago

The MPS might be maintaining the write barrier on white segments, and so making unnecessary systems calls after a fix, hurting performance.

See "Write protection on white segments" (e-mail) from me which includes an experimental patch:

==== [//info.ravenbrook.com/project/mps/master/code/poolamc.c#90](http://info.ravenbrook.com/project/mps/master/code/poolamc.c#90) (text+k) ====

1681a1682,1690
> /* We don't need to maintain the remembered set on white segments,
> so get rid of it now to avoid unnecessary write protection costs.
> Don't do this for nailed segments, because they go on the grey
> list and the summary can be used to skip them later. TODO: This
> might not be wise for multiple traces, since another trace might
> be able to eliminate this segment from scanning, and we have not
> yet proved that its contents are dead. */
> if (SegRankSet(seg) != RankSetEMPTY)
> SegSetSummary(seg, RefSetUNIV);

In the mail I wrote:

Seems to be worth about 5% on "xci6ll/hot/gcbench -P 0 -x 1234 amc" on Silverbird, and has a similar impact on "scheme-advanced test-leaf.scm" though it's a bit difficult to measure.

There is a branch and review for this visible in the Perforce branch index at https://info.ravenbrook.com/project/mps/branch/ with a review. That branch is mirrored in GitHub at https://github.com/Ravenbrook/mps/tree/branch/2016-04-04/unprotect-white

thejayps commented 1 year ago

Evidence so far of MPS running with Configura cvm suggests this isn't hurting performance