[Always cc linux-api mailing list when proposing user visible api changes] On Tue 31-10-17 22:32:44, Shawn Landden wrote: > It is common for services to be stateless around their main event loop. > If a process passes the EPOLL_KILLME flag to epoll_wait5() then it > signals to the kernel that epoll_wait5() may not complete, and the kernel > may send SIGKILL if resources get tight. > > See my systemd patch: https://github.com/shawnl/systemd/tree/killme > > Android uses this memory model for all programs, and having it in the > kernel will enable integration with the page cache (not in this > series). I have to say I completely hate the idea. You are abusing epoll_wait5 for the out of memory handling? Why is this syscall any special from any other one which sleeps and waits idle for an event? We do have per task oom_score_adj for that purposes. Besides that the patch is simply wrong because [...] > @@ -1029,6 +1030,22 @@ bool out_of_memory(struct oom_control *oc) > return true; > } > > + /* > + * Check death row. > + */ > + if (!list_empty(eventpoll_deathrow_list())) { > + struct list_head *l = eventpoll_deathrow_list(); > + struct task_struct *ts = list_first_entry(l, > + struct task_struct, se.deathrow); > + > + pr_debug("Killing pid %u from EPOLL_KILLME death row.", > + ts->pid); > + > + /* We use SIGKILL so as to cleanly interrupt ep_poll() */ > + kill_pid(task_pid(ts), SIGKILL, 1); > + return true; > + } > + this doesn't reflect the oom domain (is this memcg, mempolicy/tastset constrained OOM). You might be killing tasks which are not in the target domain. -- Michal Hocko SUSE Labs -- 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>