2024-03-07 11:15:59

by David Hildenbrand

[permalink] [raw]
Subject: Re: [PATCH 2/2] [RFC] pagemap.rst: Document write bit

On 07.03.24 12:10, Richard Weinberger wrote:
> ----- Ursprüngliche Mail -----
>> Von: "David Hildenbrand" <[email protected]>
>> An: "richard" <[email protected]>, "linux-mm" <[email protected]>
>>> + Bit 58 is useful to detect CoW mappings; however, it does not indicate
>>> + whether the page mapping is writable or not. If an anonymous mapping is
>>> + writable but the write bit is not set, it means that the next write access
>>> + will cause a page fault, and copy-on-write will happen.
>>
>> That is not true.
>
> Can you please help me correct my obvious misunderstanding?

We'll perform a page copy of an anonymous page only if the page is not
detected as exclusive to the process.

So a better description could be:

"In an private mapping, having the writable bit clear can indicate that
next write access will result in copy-on-write during a page fault. Note
that exclusive anonymous pages can be mapped read-only, and they might
simply get remapped writable during the next write fault, avoiding a
page copy."

--
Cheers,

David / dhildenb