[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [MIT-Scheme-devel] [commit f372dae] Don't call OS_free_pages after G
Taylor R Campbell
Re: [MIT-Scheme-devel] [commit f372dae] Don't call OS_free_pages after GC flip. We don't resize the heap and we will be reusing it.
Fri, 7 Oct 2011 01:47:01 +0000
IMAIL/1.21; Edwin/3.116; MIT-Scheme/9.1
Date: Thu, 6 Oct 2011 08:15:34 -0700
From: Joe Marshall <address@hidden>
On Wed, Oct 5, 2011 at 7:50 PM, Taylor R Campbell <address@hidden> wrote:
> Contrariwise, if I have six Scheme processes that have not freed their
> unused pages and the OS is constantly swapping, then the whole world
> gets much, much slower, especially at larger heap sizes. Â That's why I
> put it in there in the first place.
In theory, yes, but not in practice. Go ahead and measure it.
I did -- that's why I committed the change, and not any of various
other experiments I made to try to return pages to the OS.
Before, when I had three or four Scheme processes with large heaps, my
system was constantly swapping with a jerky cursor, unresponsive
graphics, and long delays & disk I/O when switching to an Edwin window
that has been idle for a little while. Most of my RAM would be
occupied most of the time by garbage in the unused part of the Scheme
After, my system got noticeably smoother, and stopped spending a large
amount of its time swapping.
I suspect that the long delays & disk I/O when switching to an Edwin
window were caused by the OS faulting in garbage pages from swap when
Scheme bumped the heap pointer to allocate anything -- pages which the
OS should never have stored in swap in the first place, and should
have supplied to Scheme either from their original physical pages or
from newly zero'd physical pages instead.
It's not clear to me that there's one generally best choice of
behaviour here. I would like my system, at least, to be responsive
and without a gigabyte of Scheme's garbage in swap. And in the long
run, we need a better story for how garbage collection and VM systems
cooperate, especially in low-memory situations, which I don't think
anybody has at the moment. For now, perhaps there should be a
command-line option to toggle freeing of pages.