> My very simple high-level question is still: is the patch safe? The big > benefit is that simulating a system with a large physical memory is not > killing the host. I think that it is completely safe. MAP_ANONYMOUS is a shortcut for mapping /dev/zero, and the manpage explicitly states that it zeroes memory.
> From your argument I guess the answer is: most likely, but not based on > always guaranteeing zero, but rather that zeroing should not be necessary. I think that both are likely to be the case. > Concerning the zeroing I would think the only case when we would re-use > potentially deallocated memory would be checkpoint/switching. Agreed? well, any large deallocation could potentially be reclaimed, but in practice, when you're allocating many megabytes or gigabytes malloc allocates those with mmap anyway and will nowadays return those pages back to the OS when freed. > The other question I have is, if we do not worry about the zeroing, then > why use mmap and not malloc? Now, it probably didn't matter. I think that it did a decade ago when this code was originally written. That said, mmap is what malloc will do for a large multi-paged region of memory anyway, so it doesn't matter. I think that at one point, we also used to mmap files for checkpointing, though I think we dropped that in favor of zipping them. Nate _______________________________________________ gem5-dev mailing list [email protected] http://m5sim.org/mailman/listinfo/gem5-dev
