linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Yafang Shao <laoar.shao@gmail.com>
To: Michal Hocko <mhocko@kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Linux MM <linux-mm@kvack.org>,
	 Daniel Jordan <daniel.m.jordan@oracle.com>,
	Mel Gorman <mgorman@techsingularity.net>,
	 Christoph Lameter <cl@linux.com>,
	Yafang Shao <shaoyafang@didiglobal.com>
Subject: Re: [PATCH v2] mm/vmscan: shrink slab in node reclaim
Date: Tue, 6 Aug 2019 17:15:05 +0800	[thread overview]
Message-ID: <CALOAHbDO5qmqKt8YmCkTPhh+m34RA+ahgYVgiLx1RSOJ-gM4Dw@mail.gmail.com> (raw)
In-Reply-To: <20190806090516.GM11812@dhcp22.suse.cz>

On Tue, Aug 6, 2019 at 5:05 PM Michal Hocko <mhocko@kernel.org> wrote:
>
> On Tue 06-08-19 16:57:22, Yafang Shao wrote:
> > On Tue, Aug 6, 2019 at 3:41 PM Michal Hocko <mhocko@kernel.org> wrote:
> > >
> > > On Tue 06-08-19 09:35:25, Michal Hocko wrote:
> > > > On Tue 06-08-19 03:19:00, Yafang Shao wrote:
> > > > > In the node reclaim, may_shrinkslab is 0 by default,
> > > > > hence shrink_slab will never be performed in it.
> > > > > While shrik_slab should be performed if the relcaimable slab is over
> > > > > min slab limit.
> > > > >
> > > > > Add scan_control::no_pagecache so shrink_node can decide to reclaim page
> > > > > cache, slab, or both as dictated by min_unmapped_pages and min_slab_pages.
> > > > > shrink_node will do at least one of the two because otherwise node_reclaim
> > > > > returns early.
> > > > >
> > > > > __node_reclaim can detect when enough slab has been reclaimed because
> > > > > sc.reclaim_state.reclaimed_slab will tell us how many pages are
> > > > > reclaimed in shrink slab.
> > > > >
> > > > > This issue is very easy to produce, first you continuously cat a random
> > > > > non-exist file to produce more and more dentry, then you read big file
> > > > > to produce page cache. And finally you will find that the denty will
> > > > > never be shrunk in node reclaim (they can only be shrunk in kswapd until
> > > > > the watermark is reached).
> > > > >
> > > > > Regarding vm.zone_reclaim_mode, we always set it to zero to disable node
> > > > > reclaim. Someone may prefer to enable it if their different workloads work
> > > > > on different nodes.
> > > >
> > > > Considering that this is a long term behavior of a rarely used node
> > > > reclaim I would rather not touch it unless some _real_ workload suffers
> > > > from this behavior. Or is there any reason to fix this even though there
> > > > is no evidence of real workloads suffering from the current behavior?
> > >
> > > I have only now noticed that you have added
> > > Fixes: 1c30844d2dfe ("mm: reclaim small amounts of memory when an external fragmentation event occurs")
> > >
> > > could you be more specific how that commit introduced a bug in the node
> > > reclaim? It has introduced may_shrink_slab but the direct reclaim seems
> > > to set it to 1.
> >
> > As you said, the direct reclaim path set it to 1, but the
> > __node_reclaim() forgot to process may_shrink_slab.
>
> OK, I am blind obviously. Sorry about that. Anyway, why cannot we simply
> get back to the original behavior by setting may_shrink_slab in that
> path as well?

You mean do it as the commit 0ff38490c836 did  before ?
I haven't check in which commit the shrink_slab() is removed from
__node_reclaim().
But I think introduce a flag can make it more robust, otherwise we
have to modify shrink_node() and there will be more changes.

Thanks
Yafang


  reply	other threads:[~2019-08-06  9:15 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-06  7:19 Yafang Shao
2019-08-06  7:35 ` Michal Hocko
2019-08-06  7:41   ` Michal Hocko
2019-08-06  8:57     ` Yafang Shao
2019-08-06  9:05       ` Michal Hocko
2019-08-06  9:15         ` Yafang Shao [this message]
2019-08-06  9:25           ` Michal Hocko
2019-08-06  9:32             ` Yafang Shao
2019-08-06 11:14               ` Mel Gorman
2019-08-06 11:35                 ` Yafang Shao
2019-08-06 15:59                   ` Daniel Jordan
2019-08-07  1:03                     ` Yafang Shao
2019-08-07 15:03                       ` Daniel Jordan
2019-08-06  9:50             ` Mel Gorman
2019-08-06  9:54               ` Yafang Shao
2019-08-06 10:28                 ` Michal Hocko
2019-08-06 10:59                   ` Yafang Shao
2019-08-06 11:09                     ` Michal Hocko
2019-08-06 11:34                       ` Yafang Shao
2019-08-06 11:58                     ` Michal Hocko
2019-08-06  8:23   ` Yafang Shao
2019-08-06 15:29     ` Daniel Jordan
2019-08-07  1:00       ` Yafang Shao
2019-08-07 15:03         ` Daniel Jordan

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=CALOAHbDO5qmqKt8YmCkTPhh+m34RA+ahgYVgiLx1RSOJ-gM4Dw@mail.gmail.com \
    --to=laoar.shao@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=cl@linux.com \
    --cc=daniel.m.jordan@oracle.com \
    --cc=linux-mm@kvack.org \
    --cc=mgorman@techsingularity.net \
    --cc=mhocko@kernel.org \
    --cc=shaoyafang@didiglobal.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