On Tue, Feb 15, 2022 at 11:36 AM Michal Hocko <mhocko@xxxxxxxx> wrote: > > On Tue 15-02-22 10:10:53, Suren Baghdasaryan wrote: > > On Tue, Feb 15, 2022 at 9:53 AM Yang Shi <shy828301@xxxxxxxxx> wrote: > [...] > > > Isn't the below race possible? > > > > > > CPU A CPU B > > > exiting: > > > mmap_write_lock > > > remove_vma() > > > mmap_write_unlock > > > process_mrelease: > > > mmap_read_lock > > > __oom_reap_task_mm > > > mmap_read_unlock > > > > > > > Sure, that sequence (would not call it a race) is possible but in this > > case __oom_reap_task_mm will find no vmas in the mm because exit_mmap > > freed and removed all of them. > > I didn't really have chance to have a closer look but I do not see > exit_mmap doing mm->mmap = NULL so the pointer can be a freed vma unless > I am missing something. I thought we've had it in your patches? Has this > got lost somewhere in the process? Doh! Yes, it looks like I completely missed the actual pointer. That must be it since I don't see any other possibility. Will post a patch shortly. Thanks! > -- > Michal Hocko > SUSE Labs