Re: [RFC PATCH] mm, oom: allow oom reaper to race with exit_mmap

2017-07-23 Thread Hugh Dickins
On Thu, 20 Jul 2017, Michal Hocko wrote: > On Wed 19-07-17 18:18:27, Hugh Dickins wrote: > > > > But I haven't looked at the oom_kill or oom_reaper end of it at all, > > perhaps you have an overriding argument on the placement from that end. > > Well, the main problem here is that the oom_reaper

Re: [RFC PATCH] mm, oom: allow oom reaper to race with exit_mmap

2017-07-20 Thread Michal Hocko
On Wed 19-07-17 18:18:27, Hugh Dickins wrote: > On Wed, 19 Jul 2017, Michal Hocko wrote: > > On Thu 29-06-17 10:46:21, Michal Hocko wrote: > > > Forgot to CC Hugh. > > > > > > Hugh, Andrew, do you see this could cause any problem wrt. > > > ksm/khugepaged exit path? > > > > ping. I would really a

Re: [RFC PATCH] mm, oom: allow oom reaper to race with exit_mmap

2017-07-19 Thread Hugh Dickins
On Wed, 19 Jul 2017, Michal Hocko wrote: > On Thu 29-06-17 10:46:21, Michal Hocko wrote: > > Forgot to CC Hugh. > > > > Hugh, Andrew, do you see this could cause any problem wrt. > > ksm/khugepaged exit path? > > ping. I would really appreciate some help here. I would like to resend > the patch s

Re: [RFC PATCH] mm, oom: allow oom reaper to race with exit_mmap

2017-07-18 Thread Michal Hocko
On Thu 29-06-17 10:46:21, Michal Hocko wrote: > Forgot to CC Hugh. > > Hugh, Andrew, do you see this could cause any problem wrt. > ksm/khugepaged exit path? ping. I would really appreciate some help here. I would like to resend the patch soon. > On Mon 26-06-17 15:03:46, Michal Hocko wrote: > >

Re: [RFC PATCH] mm, oom: allow oom reaper to race with exit_mmap

2017-07-12 Thread Michal Hocko
On Tue 11-07-17 13:40:04, David Rientjes wrote: > On Tue, 11 Jul 2017, Michal Hocko wrote: > > > This? > > --- > > diff --git a/mm/oom_kill.c b/mm/oom_kill.c > > index 5dc0ff22d567..e155d1d8064f 100644 > > --- a/mm/oom_kill.c > > +++ b/mm/oom_kill.c > > @@ -470,11 +470,14 @@ static bool __oom_reap

Re: [RFC PATCH] mm, oom: allow oom reaper to race with exit_mmap

2017-07-11 Thread David Rientjes
On Tue, 11 Jul 2017, Michal Hocko wrote: > This? > --- > diff --git a/mm/oom_kill.c b/mm/oom_kill.c > index 5dc0ff22d567..e155d1d8064f 100644 > --- a/mm/oom_kill.c > +++ b/mm/oom_kill.c > @@ -470,11 +470,14 @@ static bool __oom_reap_task_mm(struct task_struct *tsk, > struct mm_struct *mm) > { >

Re: [RFC PATCH] mm, oom: allow oom reaper to race with exit_mmap

2017-07-10 Thread Michal Hocko
On Mon 10-07-17 16:55:22, David Rientjes wrote: > On Mon, 26 Jun 2017, Michal Hocko wrote: > > > diff --git a/mm/mmap.c b/mm/mmap.c > > index 3bd5ecd20d4d..253808e716dc 100644 > > --- a/mm/mmap.c > > +++ b/mm/mmap.c > > @@ -2962,6 +2962,11 @@ void exit_mmap(struct mm_struct *mm) > > /* Use -1

Re: [RFC PATCH] mm, oom: allow oom reaper to race with exit_mmap

2017-07-10 Thread David Rientjes
On Tue, 27 Jun 2017, Tetsuo Handa wrote: > I wonder why you prefer timeout based approach. Your patch will after all > set MMF_OOM_SKIP if operations between down_write() and up_write() took > more than one second. lock_anon_vma_root() from unlink_anon_vmas() from > free_pgtables() for example cal

Re: [RFC PATCH] mm, oom: allow oom reaper to race with exit_mmap

2017-07-10 Thread David Rientjes
On Mon, 26 Jun 2017, Michal Hocko wrote: > diff --git a/mm/mmap.c b/mm/mmap.c > index 3bd5ecd20d4d..253808e716dc 100644 > --- a/mm/mmap.c > +++ b/mm/mmap.c > @@ -2962,6 +2962,11 @@ void exit_mmap(struct mm_struct *mm) > /* Use -1 here to ensure all VMAs in the mm are unmapped */ > unma

Re: [RFC PATCH] mm, oom: allow oom reaper to race with exit_mmap

2017-06-29 Thread Michal Hocko
Forgot to CC Hugh. Hugh, Andrew, do you see this could cause any problem wrt. ksm/khugepaged exit path? On Mon 26-06-17 15:03:46, Michal Hocko wrote: > From: Michal Hocko > > David has noticed that the oom killer might kill additional tasks while > the existing victim hasn't terminated yet beca

Re: [RFC PATCH] mm, oom: allow oom reaper to race with exit_mmap

2017-06-27 Thread Michal Hocko
On Tue 27-06-17 23:26:22, Tetsuo Handa wrote: > Michal Hocko wrote: > > On Tue 27-06-17 22:31:58, Tetsuo Handa wrote: [...] > > > shouldn't we try __oom_reap_task_mm() before calling these down_write() > > > if mm is OOM victim's? > > > > This is what we try. We simply try to get mmap_sem for read

Re: [RFC PATCH] mm, oom: allow oom reaper to race with exit_mmap

2017-06-27 Thread Tetsuo Handa
Michal Hocko wrote: > On Tue 27-06-17 22:31:58, Tetsuo Handa wrote: > > Michal Hocko wrote: > > > On Tue 27-06-17 20:39:28, Tetsuo Handa wrote: > > > > Michal Hocko wrote: > > > > > > I wonder why you prefer timeout based approach. Your patch will > > > > > > after all > > > > > > set MMF_OOM_SKIP

Re: [RFC PATCH] mm, oom: allow oom reaper to race with exit_mmap

2017-06-27 Thread Michal Hocko
On Tue 27-06-17 22:31:58, Tetsuo Handa wrote: > Michal Hocko wrote: > > On Tue 27-06-17 20:39:28, Tetsuo Handa wrote: > > > Michal Hocko wrote: > > > > > I wonder why you prefer timeout based approach. Your patch will after > > > > > all > > > > > set MMF_OOM_SKIP if operations between down_write(

Re: [RFC PATCH] mm, oom: allow oom reaper to race with exit_mmap

2017-06-27 Thread Tetsuo Handa
Michal Hocko wrote: > On Tue 27-06-17 20:39:28, Tetsuo Handa wrote: > > Michal Hocko wrote: > > > > I wonder why you prefer timeout based approach. Your patch will after > > > > all > > > > set MMF_OOM_SKIP if operations between down_write() and up_write() took > > > > more than one second. > > >

Re: [RFC PATCH] mm, oom: allow oom reaper to race with exit_mmap

2017-06-27 Thread Michal Hocko
On Tue 27-06-17 20:39:28, Tetsuo Handa wrote: > Michal Hocko wrote: > > > I wonder why you prefer timeout based approach. Your patch will after all > > > set MMF_OOM_SKIP if operations between down_write() and up_write() took > > > more than one second. > > > > if we reach down_write then we have

Re: [RFC PATCH] mm, oom: allow oom reaper to race with exit_mmap

2017-06-27 Thread Tetsuo Handa
Michal Hocko wrote: > > I wonder why you prefer timeout based approach. Your patch will after all > > set MMF_OOM_SKIP if operations between down_write() and up_write() took > > more than one second. > > if we reach down_write then we have unmapped the address space in > exit_mmap and oom reaper c

Re: [RFC PATCH] mm, oom: allow oom reaper to race with exit_mmap

2017-06-27 Thread Michal Hocko
On Tue 27-06-17 19:52:03, Tetsuo Handa wrote: > Michal Hocko wrote: > > From: Michal Hocko > > > > David has noticed that the oom killer might kill additional tasks while > > the existing victim hasn't terminated yet because the oom_reaper marks > > the curent victim MMF_OOM_SKIP too early when m

Re: [RFC PATCH] mm, oom: allow oom reaper to race with exit_mmap

2017-06-27 Thread Tetsuo Handa
Michal Hocko wrote: > From: Michal Hocko > > David has noticed that the oom killer might kill additional tasks while > the existing victim hasn't terminated yet because the oom_reaper marks > the curent victim MMF_OOM_SKIP too early when mm->mm_users dropped down > to 0. The race is as follows >