LWN.net Logo

Kernel feedback for GC (was: The Managed Runtime Initiative)

Kernel feedback for GC (was: The Managed Runtime Initiative)

Posted Jun 17, 2010 2:53 UTC (Thu) by cesarb (subscriber, #6266)
Parent article: The Managed Runtime Initiative

One thing I once thought about many years ago was a way to provide feedback to a userspace GC from the kernel as to how much memory it should use. If the kernel was under memory pressure it would tell the userspace GC to discard some pages. On the other direction, the userspace GC would tell the kernel about how many pages it expected to be able to free easily, and how many pages it expected to be able to free with a bit more effort (running a slower memory compaction, for instance).

The idea was to allow userspace programs to use the whole memory as a cache (for instance, for Firefox's memory cache) without the risk of going into swap. Also, if there were several GC-using userspace programs (for instance, several JVMs), they would be able to share the memory instead of fighting for it.

The API would be something that you would mmap() in your address space, some way to tell that something to free a page in that mapping (turning it into the shared copy-on-write zero page), some way for the program to tell the kernel how many pages it wanted to use for that memory area (a minimum value below which it cannot free anymore, an optimum value, and a maximum value above which it has no use for the memory), and some way for the kernel to notify the program about the desired usage levels for that memory area (minimum, optimum, and maximum values). As you can see, I did not work out the API details.


(Log in to post comments)

Kernel feedback for GC (was: The Managed Runtime Initiative)

Posted Jun 17, 2010 12:10 UTC (Thu) by alex (subscriber, #1355) [Link]

That sounds like extending the sort of information you can pass with the madvise() methods.

Kernel feedback for GC (was: The Managed Runtime Initiative)

Posted Jun 19, 2010 12:26 UTC (Sat) by bcopeland (subscriber, #51750) [Link]

There's some research in that direction. Here's a paper.

Kernel feedback for GC (was: The Managed Runtime Initiative)

Posted Jun 24, 2010 7:04 UTC (Thu) by renox (subscriber, #23785) [Link]

Another research about VMM / GC interaction is "Garbage collection without paging".

One author even wrote that he sent a patch to lkml but it was rejected :-(

Now that Java is opensource, one can hope that at some point GC and VMM will stop ignoring each other..

Copyright © 2013, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds