On 06/04, KOSAKI Motohiro wrote: > > > ... to set TIF_MEMDIE which should be checked in elf_core_dump(). > > > > Probably yes. > > Yep, probably. but can you please allow me additonal explanation? > > In multi threaded OOM case, we have two problematic routine, coredump > and vmscan. Roland's idea can only solve the former. > > But I also interest vmscan quickly exit if OOM received. Yes, agreed. See another email from me, MMF_ flags looks "obviously useful" to me. (I'd suggest you to add a note into the changelog, to explain that the new flag makes sense even without coredump problems). > @@ -410,6 +409,8 @@ static int __oom_kill_process(struct task_struct *p, struct mem_cgroup *mem, > */ > p->rt.time_slice = HZ; > set_tsk_thread_flag(p, TIF_MEMDIE); > + set_bit(MMF_OOM_KILLED, &p->mm->flags); > + task_unlock(p); IIUC, it has find_lock_task() mm above and thus we can trust p->mm ? (I am asking just in case, I lost the plot a bit). Ack or Reviewed, whatever your prefer. Very minor nit. > @@ -2038,6 +2038,10 @@ static int elf_core_dump(struct coredump_params *cprm) > page_cache_release(page); > } else > stop = !dump_seek(cprm->file, PAGE_SIZE); > + > + /* The task need to exit ASAP if received OOM. */ > + if (test_bit(MMF_OOM_KILLED, ¤t->mm->flags)) > + stop = 1; Perhaps this check makes more sense at the start of the loop, and there is no need to set "stop = 1" (this var is not visible outside of "for (;;) {}" anyway). Cosmetic, up to you. Oleg. -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@xxxxxxxxxx For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"dont@xxxxxxxxx"> email@xxxxxxxxx </a>