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

David Hildenbrand
2024-03-07T11:15:44Z

On 07.03.24 12:10, Richard Weinberger wrote:
> ----- Ursprüngliche Mail -----
>> Von: "David Hildenbrand" <david@redhat.com>
>> An: "richard" <richard@nod.at>, "linux-mm" <linux-mm@kvack.org>
>>> + 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