Hi

Am 28.05.26 um 11:11 schrieb Boris Brezillon:
On Thu, 28 May 2026 09:20:16 +0200
Thomas Zimmermann <[email protected]> wrote:

Hi

Am 27.05.26 um 12:18 schrieb Boris Brezillon:
[...]
-                       return ret;
+                       return vmf_insert_pfn_pmd(vmf, pfn,
+                                                 vmf->flags & 
FAULT_FLAG_WRITE);
I believe we can go back to

                        return vmf_insert_pfn_pmd(vmf, pfn, false);

if the mappings are no longer adjusted to catch write accesses.
If we don't install it as writable now, won't the kernel not split it up
into 4KiB pages when the actual write happens?
It will be installed as writeable right away, regardless of the write
parameter, because if pfn_mkwrite is not implemented, vma->vm_page_prot
won't be lowered to read-only in the first place, or at least that's
what I remember from the previous debugging session I've done.

In insert_pmd(), the write parameter controls whether we run maybe_pmd_mkwrite(), which sets the __PAGE_RW flag.

https://elixir.bootlin.com/linux/v7.1-rc5/source/mm/huge_memory.c#L1632
https://elixir.bootlin.com/linux/v7.1-rc5/source/mm/huge_memory.c#L1655

That's at least how I understand the logic here. Performance-wise it might be beneficial if we track the write flags as before.

Best regards
Thomas


--
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstr. 146, 90461 Nürnberg, Germany, www.suse.com
GF: Jochen Jaser, Andrew McDonald, Werner Knoblich, (HRB 36809, AG Nürnberg)


Reply via email to