On Wed 15-07-20 11:10:07, Yafang Shao wrote: [...] > If it is the race which causes this issue and we want to reduce the > race window, I don't know whether it is proper to check the memcg > margin in out_of_memory() or do it before calling do_send_sig_info(). > Because per my understanding, dump_header() always takes much more > time than select_bad_process() especially if there're slow consoles. > So the race might easily happen when doing dump_header() or dumping > other information, but if we check the memcg margin after dumping this > oom info, it would be strange to dump so much oom logs without killing > a process. Yes, this is my experience as well. Unless there are gazillions of tasks the oom victim selection should be reasonably swift. It is usually the oom report which takes the most time and this is a huge race window. So I think it would be best to go with your patch for now. It is more in line with the global oom flow and it is much easier to reason about. -- Michal Hocko SUSE Labs