[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YRp4+EmohNoxzv2x@casper.infradead.org>
Date: Mon, 16 Aug 2021 15:40:56 +0100
From: Matthew Wilcox <willy@...radead.org>
To: David Hildenbrand <david@...hat.com>
Cc: Khalid Aziz <khalid.aziz@...cle.com>,
"Longpeng (Mike, Cloud Infrastructure Service Product Dept.)"
<longpeng2@...wei.com>, Steven Sistare <steven.sistare@...cle.com>,
Anthony Yznaga <anthony.yznaga@...cle.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linux-mm@...ck.org" <linux-mm@...ck.org>,
"Gonglei (Arei)" <arei.gonglei@...wei.com>
Subject: Re: [RFC PATCH 0/5] madvise MADV_DOEXEC
On Mon, Aug 16, 2021 at 04:33:09PM +0200, David Hildenbrand wrote:
> > > I did not follow why we have to play games with MAP_PRIVATE, and having
> > > private anonymous pages shared between processes that don't COW, introducing
> > > new syscalls etc.
> >
> > It's not about SHMEM, it's about file-backed pages on regular
> > filesystems. I don't want to have XFS, ext4 and btrfs all with their
> > own implementations of ARCH_WANT_HUGE_PMD_SHARE.
>
> Let me ask this way: why do we have to play such games with MAP_PRIVATE?
Are you referring to this?
: 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.
If so, that's a misunderstanding, because there are no games being played.
What Khalid's saying there is that because the page tables are already
shared for that range of address space, the COW of a MAP_PRIVATE will
create a new page, but that page will be shared between all the sharers.
The second write to a MAP_PRIVATE page (by any of the sharers) will not
create a COW situation. Just like if all the sharers were threads of
the same process.
Powered by blists - more mailing lists