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

From: Chih-En Lin
Date: Wed Sep 28 2022 - 04:36:33 EST


On Tue, Sep 27, 2022 at 02:22:27PM -0700, John Hubbard wrote:
> > +extern int sysctl_cow_pte_pid;
>
> So are setting a global value, to a single pid?? Only one pid at a time
> can be set up?
>
> I think that tells you already that there is a huge API problem here.
>
> As the other thread with Nadav said, this is not a sysctl. It wants to
> be a prctl(), at least the way things look so far.

I will change it to use the prctl().
Probably it will be under PR_SET_MM or create a new option.

> > +static void set_cow_pte_task(void)
> > +{
> > + struct pid *pid;
> > + struct task_struct *task;
> > +
> > + pid = find_get_pid(sysctl_cow_pte_pid);
>
> This seems to be missing a corresponding call to put_pid().

Thanks.

> thanks,
>
> --
> John Hubbard
> NVIDIA
>

Best regards,
Chih-En Lin