Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1322345
| From | Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH 4/3] mm, oom: drop the last allocation attempt before out_of_memory |
| Date | 2016-01-30 13:20 +0100 |
| Message-ID | <qWCFs-2wT-13@gated-at.bofh.it> (permalink) |
| References | <qW1FU-qH-19@gated-at.bofh.it> <qW2si-Yt-23@gated-at.bofh.it> <qW414-2cO-19@gated-at.bofh.it> <qW4DM-2tl-3@gated-at.bofh.it> <qWjjs-59f-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
Michal Hocko wrote: > > https://lkml.org/lkml/2015/3/25/40 > > > > We could have out_of_memory() wait until the number of outstanding OOM > > victims drops to 0. Then __alloc_pages_may_oom() doesn't relinquish > > the lock until its kill has been finalized: > > > > diff --git a/mm/oom_kill.c b/mm/oom_kill.c > > index 914451a..4dc5b9d 100644 > > --- a/mm/oom_kill.c > > +++ b/mm/oom_kill.c > > @@ -892,7 +892,9 @@ bool out_of_memory(struct oom_control *oc) > > * Give the killed process a good chance to exit before trying > > * to allocate memory again. > > */ > > - schedule_timeout_killable(1); > > + if (!test_thread_flag(TIF_MEMDIE)) > > + wait_event_timeout(oom_victims_wait, > > + !atomic_read(&oom_victims), HZ); > > } > > return true; > > } > > Yes this makes sense to me I think schedule_timeout_killable(1) was used for handling cases where current thread did not get TIF_MEMDIE but got SIGKILL due to sharing the victim's memory. If current thread is blocking TIF_MEMDIE thread, this can become a needless delay. Also, I don't know whether using wait_event_*() helps handling a problem that schedule_timeout_killable(1) can sleep for many minutes with oom_lock held when there are a lot of tasks. Detail is explained in my proposed patch.
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 4/3] mm, oom: drop the last allocation attempt before out_of_memory Michal Hocko <mhocko@kernel.org> - 2016-01-28 21:50 +0100
Re: [PATCH 4/3] mm, oom: drop the last allocation attempt before out_of_memory Johannes Weiner <hannes@cmpxchg.org> - 2016-01-28 22:40 +0100
Re: [PATCH 4/3] mm, oom: drop the last allocation attempt before out_of_memory David Rientjes <rientjes@google.com> - 2016-01-29 00:20 +0100
Re: [PATCH 4/3] mm, oom: drop the last allocation attempt before out_of_memory Johannes Weiner <hannes@cmpxchg.org> - 2016-01-29 01:00 +0100
Re: [PATCH 4/3] mm, oom: drop the last allocation attempt before out_of_memory Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> - 2016-01-29 11:40 +0100
Re: [PATCH 4/3] mm, oom: drop the last allocation attempt before out_of_memory Michal Hocko <mhocko@kernel.org> - 2016-01-29 16:40 +0100
Re: [PATCH 4/3] mm, oom: drop the last allocation attempt before out_of_memory Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> - 2016-01-30 13:20 +0100
Re: [PATCH 4/3] mm, oom: drop the last allocation attempt before out_of_memory Michal Hocko <mhocko@kernel.org> - 2016-01-29 16:30 +0100
Re: [PATCH 4/3] mm, oom: drop the last allocation attempt before out_of_memory Michal Hocko <mhocko@kernel.org> - 2016-01-29 16:30 +0100
csiph-web