Re: [RFC PATCH v2 2/9] mm: pgtable: Add sysctl to enable COW PTE

From: Nadav Amit
Date: Tue Sep 27 2022 - 13:28:00 EST


On Sep 27, 2022, at 9:29 AM, Chih-En Lin <shiyn.lin@xxxxxxxxx> wrote:

> Add a new sysctl vm.cow_pte to set MMF_COW_PTE_READY flag for enabling
> copy-on-write (COW) to the PTE page table during the next time of fork.
>
> Since it has a time gap between using the sysctl to enable the COW PTE
> and doing the fork, we use two states to determine the task that wants
> to do COW PTE or already doing it.

I don’t get why it is needed in general and certainly why sysctl controls
this behavior.

IIUC, it sounds that you want prctl and not sysctl for such control. But
clearly you think that this control is needed because there is a tradeoff.
Please explain the tradeoff and how users are expected to make a decision
whether to turn the flag or not.