Re: [private] Re: [RFC PATCH 0/5] madvise MADV_DOEXEC

From: David Hildenbrand
Date: Mon Aug 16 2021 - 08:30:43 EST


On 16.08.21 14:27, David Hildenbrand wrote:
On 16.08.21 14:07, Matthew Wilcox wrote:
On Mon, Aug 16, 2021 at 10:02:22AM +0200, David Hildenbrand wrote:
Mappings within this address range behave as if they were shared
between threads, so a write to a MAP_PRIVATE mapping will create a
page which is shared between all the sharers. The first process that
declares an address range mshare'd can continue to map objects in the
shared area. All other processes that want mshare'd access to this
memory area can do so by calling mshare(). After this call, the
address range given by mshare becomes a shared range in its address
space. Anonymous mappings will be shared and not COWed.

Did I understand correctly that you want to share actual page tables between
processes and consequently different MMs? That sounds like a very bad idea.

That is the entire point. Consider a machine with 10,000 instances
of an application running (process model, not thread model). If each
application wants to map 1TB of RAM using 2MB pages, that's 4MB of page
tables per process or 40GB of RAM for the whole machine.

Note that I am working on asynchronous reclaim of page tables, whereby I
would even reclaim !anonymous page tables under memory pressure.

Assuming your processes don't touch all memory all the time of course
... of course, it's a research project and will still require quite some
work because devil is in the detail (locking).


Well, that comment did turn out not-so-private, so it's certainly a good discussion-starter.

--
Thanks,

David / dhildenb