linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Michal Hocko <mhocko@kernel.org>
To: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Cc: cl@linux.com, htejun@gmail.com, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org, torvalds@linux-foundation.org,
	rientjes@google.com, oleg@redhat.com, kwalker@redhat.com,
	akpm@linux-foundation.org, hannes@cmpxchg.org,
	vdavydov@parallels.com, skozina@redhat.com, mgorman@suse.de,
	riel@redhat.com
Subject: Re: [PATCH] mm,vmscan: Use accurate values for zone_reclaimable() checks
Date: Tue, 27 Oct 2015 10:22:31 +0100	[thread overview]
Message-ID: <20151027092231.GC9891@dhcp22.suse.cz> (raw)
In-Reply-To: <201510251952.CEF04109.OSOtLFHFVFJMQO@I-love.SAKURA.ne.jp>

On Sun 25-10-15 19:52:59, Tetsuo Handa wrote:
[...]
> Three approaches are proposed for fixing this silent livelock problem.
> 
>  (1) Use zone_page_state_snapshot() instead of zone_page_state()
>      when doing zone_reclaimable() checks. This approach is clear,
>      straightforward and easy to backport. So far I cannot reproduce
>      this livelock using this change. But there might be more locations
>      which should use zone_page_state_snapshot().
> 
>  (2) Use a dedicated workqueue for vmstat_update item which is guaranteed
>      to be processed immediately. So far I cannot reproduce this livelock
>      using a dedicated workqueue created with WQ_MEM_RECLAIM|WQ_HIGHPRI
>      (patch proposed by Christoph Lameter). But according to Tejun Heo,
>      if we want to guarantee that nobody can reproduce this livelock, we
>      need to modify workqueue API because commit 3270476a6c0c ("workqueue:
>      reimplement WQ_HIGHPRI using a separate worker_pool") which went to
>      Linux 3.6 lost the guarantee.
> 
>  (3) Use a !TASK_RUNNING sleep inside page allocator side. This approach
>      is easy to backport. So far I cannot reproduce this livelock using
>      this approach. And I think that nobody can reproduce this livelock
>      because this changes the page allocator to obey the workqueue's
>      expectations. Even if we leave this livelock problem aside, not
>      entering into !TASK_RUNNING state for too long is an exclusive
>      occupation of workqueue which will make other items in the workqueue
>      needlessly deferred. We don't need to defer other items which do not
>      invoke a __GFP_WAIT allocation.
> 
> This patch does approach (3), by inserting an uninterruptible sleep into
> page allocator side before retrying, in order to make sure that other
> workqueue items (especially vmstat_update item) are given a chance to be
> processed.
> 
> Although a different problem, by using approach (3), we can alleviate
> needlessly burning CPU cycles even when we hit OOM-killer livelock problem
> (hang up after the OOM-killer messages are printed because the OOM victim
> cannot terminate due to dependency).

I really dislike this approach. Waiting without having an event to
wait for is just too ugly. I think 1) is easiest to backport to
stable kernels without causing any other regressions. 2) is the way
to move forward for next kernels and we should really think whether
WQ_MEM_RECLAIM should imply also WQ_HIGHPRI by default. If there is a
general consensus that there are legitimate WQ_MEM_RECLAIM users which
can do without the other flag then I am perfectly OK to use it for
vmstat and oom sysrq dedicated workqueues.

> Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
[...]
-- 
Michal Hocko
SUSE Labs

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  parent reply	other threads:[~2015-10-27  9:22 UTC|newest]

Thread overview: 61+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-21 12:26 [PATCH] mm,vmscan: Use accurate values for zone_reclaimable() checks Tetsuo Handa
2015-10-21 13:03 ` Michal Hocko
2015-10-21 14:22 ` Christoph Lameter
2015-10-21 14:33   ` Michal Hocko
2015-10-21 14:49     ` Christoph Lameter
2015-10-21 14:55       ` Michal Hocko
2015-10-21 15:39         ` Tetsuo Handa
2015-10-21 17:16         ` Christoph Lameter
2015-10-22 11:37           ` Tetsuo Handa
2015-10-22 13:39             ` Christoph Lameter
2015-10-22 14:09               ` Tejun Heo
2015-10-22 14:21                 ` Tejun Heo
2015-10-22 14:23                   ` Christoph Lameter
2015-10-22 14:24                     ` Tejun Heo
2015-10-22 14:25                       ` Christoph Lameter
2015-10-22 14:33                         ` Tejun Heo
2015-10-22 14:41                           ` Christoph Lameter
2015-10-22 15:14                             ` Tejun Heo
2015-10-23  4:26                               ` Tejun Heo
2015-11-02 15:01                                 ` Michal Hocko
2015-11-02 19:20                                   ` Tejun Heo
2015-11-03  2:32                                     ` Tetsuo Handa
2015-11-03 19:43                                       ` Tejun Heo
2015-11-05 14:59                                   ` Tetsuo Handa
2015-11-05 17:45                                     ` Christoph Lameter
2015-11-06  0:16                                       ` Tejun Heo
2015-11-11 15:44                                         ` Michal Hocko
2015-11-11 16:03                                           ` Michal Hocko
2015-10-22 14:22                 ` Christoph Lameter
2015-10-22 15:06                 ` Michal Hocko
2015-10-22 15:15                   ` Tejun Heo
2015-10-22 15:33                     ` Christoph Lameter
2015-10-23  8:37                       ` Michal Hocko
2015-10-23 11:43                         ` Make vmstat deferrable again (was Re: [PATCH] mm,vmscan: Use accurate values for zone_reclaimable() checks) Christoph Lameter
2015-10-23 12:07                           ` Sergey Senozhatsky
2015-10-23 14:12                             ` Christoph Lameter
2015-10-23 14:49                               ` Sergey Senozhatsky
2015-10-23 16:10                                 ` Christoph Lameter
2015-10-22 15:35                     ` [PATCH] mm,vmscan: Use accurate values for zone_reclaimable() checks Michal Hocko
2015-10-22 15:37                       ` Tejun Heo
2015-10-22 15:49                         ` Michal Hocko
2015-10-22 18:42                           ` Tejun Heo
2015-10-22 21:42                             ` [PATCH] mm,vmscan: Use accurate values for zone_reclaimable()checks Tetsuo Handa
2015-10-22 22:47                               ` Tejun Heo
2015-10-23  8:36                               ` Michal Hocko
2015-10-23 10:37                                 ` Tejun Heo
2015-10-23  8:33                             ` [PATCH] mm,vmscan: Use accurate values for zone_reclaimable() checks Michal Hocko
2015-10-23 10:36                               ` Tejun Heo
2015-10-23 11:11                                 ` Michal Hocko
2015-10-23 12:25                                   ` Tetsuo Handa
2015-10-23 18:23                                     ` Tejun Heo
2015-10-25 10:52                                       ` Tetsuo Handa
2015-10-25 22:47                                         ` Tejun Heo
2015-10-27  9:22                                         ` Michal Hocko [this message]
2015-10-27 10:55                                           ` Tejun Heo
2015-10-27 12:07                                             ` Michal Hocko
2015-10-23 18:21                                   ` Tejun Heo
2015-10-27  9:16                                     ` Michal Hocko
2015-10-27 10:52                                       ` Tejun Heo
2015-10-27 11:07                                       ` [PATCH] mm,vmscan: Use accurate values for zone_reclaimable()checks Tetsuo Handa
2015-10-27 11:30                                         ` Tejun Heo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20151027092231.GC9891@dhcp22.suse.cz \
    --to=mhocko@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=cl@linux.com \
    --cc=hannes@cmpxchg.org \
    --cc=htejun@gmail.com \
    --cc=kwalker@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mgorman@suse.de \
    --cc=oleg@redhat.com \
    --cc=penguin-kernel@I-love.SAKURA.ne.jp \
    --cc=riel@redhat.com \
    --cc=rientjes@google.com \
    --cc=skozina@redhat.com \
    --cc=torvalds@linux-foundation.org \
    --cc=vdavydov@parallels.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).