Message ID | 20180710094341.GD14284@dhcp22.suse.cz (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Tue, 10 Jul 2018, Michal Hocko wrote: > What do you think about the following? > > diff --git a/mm/oom_kill.c b/mm/oom_kill.c > index ed9d473c571e..32e6f7becb40 100644 > --- a/mm/oom_kill.c > +++ b/mm/oom_kill.c > @@ -53,6 +53,14 @@ int sysctl_panic_on_oom; > int sysctl_oom_kill_allocating_task; > int sysctl_oom_dump_tasks = 1; > > +/* > + * Serializes oom killer invocations (out_of_memory()) from all contexts to > + * prevent from over eager oom killing (e.g. when the oom killer is invoked > + * from different domains). > + * > + * oom_killer_disable() relies on this lock to stabilize oom_killer_disabled > + * and mark_oom_victim > + */ > DEFINE_MUTEX(oom_lock); > > #ifdef CONFIG_NUMA I think it's better, thanks. However, does it address the question about why __oom_reap_task_mm() needs oom_lock protection? Perhaps it would be helpful to mention synchronization between reaping triggered from oom_reaper and by exit_mmap().
On Tue, 10 Jul 2018, David Rientjes wrote: > I think it's better, thanks. However, does it address the question about > why __oom_reap_task_mm() needs oom_lock protection? Perhaps it would be > helpful to mention synchronization between reaping triggered from > oom_reaper and by exit_mmap(). > Actually, can't we remove the need to take oom_lock in exit_mmap() if __oom_reap_task_mm() can do a test and set on MMF_UNSTABLE and, if already set, bail out immediately?
On Tue 10-07-18 14:12:28, David Rientjes wrote: > On Tue, 10 Jul 2018, David Rientjes wrote: > > > I think it's better, thanks. However, does it address the question about > > why __oom_reap_task_mm() needs oom_lock protection? Perhaps it would be > > helpful to mention synchronization between reaping triggered from > > oom_reaper and by exit_mmap(). > > > > Actually, can't we remove the need to take oom_lock in exit_mmap() if > __oom_reap_task_mm() can do a test and set on MMF_UNSTABLE and, if already > set, bail out immediately? I think we do not really depend on oom_lock anymore in __oom_reap_task_mm. The race it was original added for (mmget_not_zero vs. exit path) is no longer a problem. I didn't really get to evaluate it deeper though. There are just too many things going on in parallel. Tetsuo was proposing some patches to remove the lock but those patches had some other problems. If we have a simple patch to remove the oom_lock from the oom reaper then I will review it. I am not sure I can come up with a patch myself in few days.
diff --git a/mm/oom_kill.c b/mm/oom_kill.c index ed9d473c571e..32e6f7becb40 100644 --- a/mm/oom_kill.c +++ b/mm/oom_kill.c @@ -53,6 +53,14 @@ int sysctl_panic_on_oom; int sysctl_oom_kill_allocating_task; int sysctl_oom_dump_tasks = 1; +/* + * Serializes oom killer invocations (out_of_memory()) from all contexts to + * prevent from over eager oom killing (e.g. when the oom killer is invoked + * from different domains). + * + * oom_killer_disable() relies on this lock to stabilize oom_killer_disabled + * and mark_oom_victim + */ DEFINE_MUTEX(oom_lock); #ifdef CONFIG_NUMA