linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Daniel Jordan <daniel.m.jordan@oracle.com>
To: Yafang Shao <laoar.shao@gmail.com>
Cc: akpm@linux-foundation.org, linux-mm@kvack.org,
	Michal Hocko <mhocko@kernel.org>,
	Yafang Shao <shaoyafang@didiglobal.com>,
	Mel Gorman <mgorman@techsingularity.net>,
	Christoph Lameter <cl@linux.com>
Subject: Re: [PATCH RESEND] mm/vmscan: shrink slab in node reclaim
Date: Mon, 5 Aug 2019 17:44:31 -0400	[thread overview]
Message-ID: <20190805214219.fxida5zojihauo7d@ca-dmjordan1.us.oracle.com> (raw)
In-Reply-To: <1564538401-21353-1-git-send-email-laoar.shao@gmail.com>

Hi Yafang,

On Tue, Jul 30, 2019 at 10:00:01PM -0400, 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.

Nice catch, I think this needs

Fixes: 1c30844d2dfe ("mm: reclaim small amounts of memory when an external fragmentation event occurs")

> If reclaimable pagecache is less than min_unmapped_pages while
> reclaimable slab is greater than min_slab_pages, we only shrink slab.
> Otherwise the min_unmapped_pages will be useless under this condition.
> A new bitmask no_pagecache is introduced in scan_control for this
> purpose, which is 0 by default.
> Once __node_reclaim() is called, either the reclaimable pagecache is
> greater than min_unmapped_pages or reclaimable slab is greater than
> min_slab_pages, that is ensured in function node_reclaim(). So wen can
> remove the if statement in __node_reclaim().

Why is the if statement there to begin with then, if the condition has
already been checked in node_reclaim?  Looks like it came in with
0ff38490c836 ("[PATCH] zone_reclaim: dynamic slab reclaim"), but it's not
obvious to me why.  Maybe Christoph remembers.

I found this part of the changelog kind of hard to parse.  This instead instead
of above block?

    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.

Maybe start the next paragraph with

  __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.
...

> diff --git a/mm/vmscan.c b/mm/vmscan.c
> index 47aa215..1e410ef 100644
> --- a/mm/vmscan.c
> +++ b/mm/vmscan.c
> @@ -91,6 +91,9 @@ struct scan_control {
>  	/* e.g. boosted watermark reclaim leaves slabs alone */
>  	unsigned int may_shrinkslab:1;
>  
> +	/* in node relcaim mode, we may shrink slab only */

                   reclaim

> @@ -4268,6 +4273,10 @@ static int __node_reclaim(struct pglist_data *pgdat, gfp_t gfp_mask, unsigned in
>  		.may_writepage = !!(node_reclaim_mode & RECLAIM_WRITE),
>  		.may_unmap = !!(node_reclaim_mode & RECLAIM_UNMAP),
>  		.may_swap = 1,
> +		.may_shrinkslab = (node_page_state(pgdat, NR_SLAB_RECLAIMABLE) >
> +				   pgdat->min_slab_pages),
> +		.no_pagecache = !(node_pagecache_reclaimable(pgdat) >
> +				  pgdat->min_unmapped_pages),

It's less awkward to do away with the ! and invert the condition.


  reply	other threads:[~2019-08-05 21:44 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-31  2:00 Yafang Shao
2019-08-05 21:44 ` Daniel Jordan [this message]
2019-08-06  6:44   ` Yafang Shao

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=20190805214219.fxida5zojihauo7d@ca-dmjordan1.us.oracle.com \
    --to=daniel.m.jordan@oracle.com \
    --cc=akpm@linux-foundation.org \
    --cc=cl@linux.com \
    --cc=laoar.shao@gmail.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