On 8/22/23 12:54, Warner Losh wrote:
As a practical matter, they both consume about the same resources until the
MAP_ANON
region starts to get populated with data...
With PROT_NONE, I think they would have the same effect. If it is to be a
backing store for
something like malloc, then MAP_ANON would be best. If you are replacing it
with a lot of
things, like a mix of files, devices and/or anon memory, then MAP_GUARD and
replace it
with MAP_FIXED later. Most likely you'll want MAP_GUARD to reserve the area,
and then
MAP_FIXED to use it for mmap'd memory, shared memory, executable pages, etc.
Does that tell you what you need to know?
Yes.
The reserved_va area is replaced with a mix of files, anon, etc, based on whatever the
guest requires. So it might be reasonable to adjust bsd-user/mmap.c to use MAP_GUARD for
managing the reserved_va area instead of MAP_ANON. No rush, of course.
r~