Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1689070

Re: [PATCH v2] mm/page_alloc: Wait for oom_lock before retrying.

From Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Newsgroups linux.kernel
Subject Re: [PATCH v2] mm/page_alloc: Wait for oom_lock before retrying.
Date 2017-07-17 16:00 +0200
Message-ID <u4eJ4-5NI-7@gated-at.bofh.it> (permalink)
References <u3PAZ-6Cr-9@gated-at.bofh.it> <u4a2L-2Ji-45@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Michal Hocko wrote:
> On Sun 16-07-17 19:59:51, Tetsuo Handa wrote:
> > Since the whole memory reclaim path has never been designed to handle the
> > scheduling priority inversions, those locations which are assuming that
> > execution of some code path shall eventually complete without using
> > synchronization mechanisms can get stuck (livelock) due to scheduling
> > priority inversions, for CPU time is not guaranteed to be yielded to some
> > thread doing such code path.
> > 
> > mutex_trylock() in __alloc_pages_may_oom() (waiting for oom_lock) and
> > schedule_timeout_killable(1) in out_of_memory() (already held oom_lock) is
> > one of such locations, and it was demonstrated using artificial stressing
> > that the system gets stuck effectively forever because SCHED_IDLE priority
> > thread is unable to resume execution at schedule_timeout_killable(1) if
> > a lot of !SCHED_IDLE priority threads are wasting CPU time [1].
> 
> I do not understand this. All the contending tasks will go and sleep for
> 1s. How can they preempt the lock holder?

Not 1s. It sleeps for only 1 jiffies, which is 1ms if CONFIG_HZ=1000.

And 1ms may not be long enough to allow the owner of oom_lock when there are
many threads doing the same thing. I demonstrated that SCHED_IDLE oom_lock
owner is completely defeated by a bunch of !SCHED_IDLE contending threads.

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v2] mm/page_alloc: Wait for oom_lock before retrying. Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> - 2017-07-16 13:10 +0200
  Re: [PATCH v2] mm/page_alloc: Wait for oom_lock before retrying. Michal Hocko <mhocko@kernel.org> - 2017-07-17 11:00 +0200
    Re: [PATCH v2] mm/page_alloc: Wait for oom_lock before retrying. Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> - 2017-07-17 16:00 +0200
      Re: [PATCH v2] mm/page_alloc: Wait for oom_lock before retrying. Michal Hocko <mhocko@kernel.org> - 2017-07-17 17:20 +0200
  Re: [PATCH v2] mm/page_alloc: Wait for oom_lock before retrying. Michal Hocko <mhocko@kernel.org> - 2017-07-17 17:30 +0200
    Re: [PATCH v2] mm/page_alloc: Wait for oom_lock before retrying. Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> - 2017-07-17 23:50 +0200
      Re: [PATCH v2] mm/page_alloc: Wait for oom_lock before retrying. Michal Hocko <mhocko@kernel.org> - 2017-07-18 11:10 +0200

csiph-web