On Tue, Apr 18, 2023 at 8:48 AM Peter Xu <peterx@xxxxxxxxxx> 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 >