Re: [PATCH v2 1/1] mm: do not increment pgfault stats when page fault handler retries

From: Suren Baghdasaryan
Date: Mon Apr 17 2023 - 18:48:25 EST


On Mon, Apr 17, 2023 at 2:26 PM Peter Xu <peterx@xxxxxxxxxx> wrote:
>
> On Fri, Apr 14, 2023 at 05:08:18PM -0700, Suren Baghdasaryan wrote:
> > @@ -5223,8 +5230,8 @@ vm_fault_t handle_mm_fault(struct vm_area_struct *vma, unsigned long address,
> > if (task_in_memcg_oom(current) && !(ret & VM_FAULT_OOM))
> > mem_cgroup_oom_synchronize(false);
> > }
> > -
> > - mm_account_fault(regs, address, flags, ret);
> > +out:
> > + mm_account_fault(mm, regs, address, flags, ret);
>
> Ah, one more question.. can this cached mm race with a destroying mm (just
> like the vma race we wanted to avoid)? Still a question only applies to
> COMPLETE case when mmap read lock can be released. Thanks,

I believe that is impossible because whoever is calling the page fault
handler has stabilized the mm by getting a refcount.

>
> >
> > return ret;
> > }
>
> --
> Peter Xu
>