Oleg Nesterov wrote: > > > Hmm. If we already have mmap_sem and started zap_page_range() then > > > I do not think it makes sense to stop until we free everything we can. > > > > Zapping a huge address space can take quite some time > > Yes, and this is another reason we should do this asynchronously. > > > and we really do > > not have to free it all on behalf of the killer when enough memory is > > freed to allow for further progress and the rest can be done by the > > victim. If one batch doesn't seem sufficient then another retry can > > continue. > > > > I do not think that a limited scan would make the implementation more > > complicated > > But we can't even know much memory unmap_single_vma() actually frees. > Even if we could, how can we know we freed enough? > > Anyway. Perhaps it makes sense to abort the for_each_vma() loop if > freed_enough_mem() == T. But it is absolutely not clear to me how we > should define this freed_enough_mem(), so I think we should do this > later. Maybe bool freed_enough_mem(void) { !atomic_read(&oom_victims); } if we change to call mark_oom_victim() on all threads which should be killed as OOM victims. -- 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>