On Mon 25-04-22 15:00:24, Nico Pache wrote: > > > On 4/22/22 11:38, Michal Hocko wrote: > > On Thu 21-04-22 15:05:33, Nico Pache wrote: > >> The MMF_OOM_SKIP bit is used to indicate weather a mm_struct can not be > >> invalided or has already been invalided. exit_mmap currently calls > >> __oom_reap_task_mm unconditionally despite the fact that the oom reaper > >> may have already called this. > >> > >> Add a check for the MMF_OOM_SKIP bit being set in exit_mmap to avoid > >> unnessary calls to the invalidate code. > > > > Why do we care about this? > Is there no cost to the MMU/TLB invalidation? The MMU notifier contains a lock > too so perhaps we can also avoids some unnecessary MMU notifier lock contention. I am pretty sure that this area can be micro optimized but I do not really see a strong reason for that. OOM victims are/should be really rare so I do not think that any performance optimization would be really visible. If you want to improve the code then I think a much better plan would be to get rid of the whole oom special case altogether. This might be much closer than ever after Hugh's recent m{un}lock changes. I didn't have time to think that through though. I believe Suren Baghdasaryan has been looking into that as well. -- Michal Hocko SUSE Labs