On Thu, 20 Jul 2017, Michal Hocko wrote: > On Wed 19-07-17 18:18:27, Hugh Dickins wrote: > > > > But I haven't looked at the oom_kill or oom_reaper end of it at all, > > perhaps you have an overriding argument on the placement from that end. > > Well, the main problem here is that the oom_reaper tries to > MADV_DONTNEED the oom victim and then hide it from the oom killer (by > setting MMF_OOM_SKIP) to guarantee a forward progress. In order to do > that it needs mmap_sem for read. Currently we try to avoid races with > the eixt path by checking mm->mm_users and that can lead to premature > MMF_OOM_SKIP and that in turn to additional oom victim(s) selection > while the current one is still tearing the address space down. > > One way around that is to allow final unmap race with the oom_reaper > tear down. > > I hope this clarify the motivation Thanks, yes, if you have a good reason of that kind, then I agree that it's appropriate to leave the down_write(mmap_sem) until reaching the free_pgtables() stage. Hugh -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@xxxxxxxxx. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"dont@xxxxxxxxx"> email@xxxxxxxxx </a>