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

Suren Baghdasaryan
2023-04-18T16:46:09Z

On Tue, Apr 18, 2023 at 8:48 AM Peter Xu <peterx@redhat.com> wrote:
>
> On Tue, Apr 18, 2023 at 04:32:27PM +0100, Matthew Wilcox wrote:
> > ... when we called clone()? A thread by definition has a reference to
> > its own mm.
>
> Ah yes.. thanks!

re: I also had a quick look on do_exit() but I also didn't see where
do we e.g. wait for all the threads to stop before recycles a mm.

We recycle mm after all refcounts are dropped in the exit path:
do_exit
exit_mm
mmput(if !mm->mm_users)
mmdrop(if !mm->mm_count)
free_mm

>
> --
> Peter Xu
>