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

From: David Hildenbrand
Date: Thu Mar 07 2024 - 06:15:55 EST


On 07.03.24 12:10, Richard Weinberger wrote:
----- Ursprüngliche Mail -----
Von: "David Hildenbrand" <david@xxxxxxxxxx>
An: "richard" <richard@xxxxxx>, "linux-mm" <linux-mm@xxxxxxxxx>
+ 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