linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Shakeel Butt <shakeelb@google.com>
To: Yang Shi <yang.shi@linux.alibaba.com>
Cc: Huang Ying <ying.huang@intel.com>,
	Johannes Weiner <hannes@cmpxchg.org>,
	 Michal Hocko <mhocko@suse.com>,
	Mel Gorman <mgorman@techsingularity.net>,
	 "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>,
	Hugh Dickins <hughd@google.com>,
	 Andrew Morton <akpm@linux-foundation.org>,
	Linux MM <linux-mm@kvack.org>,
	 LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] mm: vmscan: correct nr_reclaimed for THP
Date: Thu, 9 May 2019 17:39:57 -0700	[thread overview]
Message-ID: <CALvZod5LjCMxsPhbY68QRggFy4QjVsTDXh192PqSW6qsMCKknw@mail.gmail.com> (raw)
In-Reply-To: <1557447392-61607-1-git-send-email-yang.shi@linux.alibaba.com>

From: Yang Shi <yang.shi@linux.alibaba.com>
Date: Thu, May 9, 2019 at 5:16 PM
To: <ying.huang@intel.com>, <hannes@cmpxchg.org>, <mhocko@suse.com>,
<mgorman@techsingularity.net>, <kirill.shutemov@linux.intel.com>,
<hughd@google.com>, <akpm@linux-foundation.org>
Cc: <yang.shi@linux.alibaba.com>, <linux-mm@kvack.org>,
<linux-kernel@vger.kernel.org>

> Since commit bd4c82c22c36 ("mm, THP, swap: delay splitting THP after
> swapped out"), THP can be swapped out in a whole.  But, nr_reclaimed
> still gets inc'ed by one even though a whole THP (512 pages) gets
> swapped out.
>
> This doesn't make too much sense to memory reclaim.  For example, direct
> reclaim may just need reclaim SWAP_CLUSTER_MAX pages, reclaiming one THP
> could fulfill it.  But, if nr_reclaimed is not increased correctly,
> direct reclaim may just waste time to reclaim more pages,
> SWAP_CLUSTER_MAX * 512 pages in worst case.
>
> This change may result in more reclaimed pages than scanned pages showed
> by /proc/vmstat since scanning one head page would reclaim 512 base pages.
>
> Cc: "Huang, Ying" <ying.huang@intel.com>
> Cc: Johannes Weiner <hannes@cmpxchg.org>
> Cc: Michal Hocko <mhocko@suse.com>
> Cc: Mel Gorman <mgorman@techsingularity.net>
> Cc: "Kirill A . Shutemov" <kirill.shutemov@linux.intel.com>
> Cc: Hugh Dickins <hughd@google.com>
> Signed-off-by: Yang Shi <yang.shi@linux.alibaba.com>

Nice find.

Reviewed-by: Shakeel Butt <shakeelb@google.com>

> ---
> I'm not quite sure if it was the intended behavior or just omission. I tried
> to dig into the review history, but didn't find any clue. I may miss some
> discussion.
>
>  mm/vmscan.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/mm/vmscan.c b/mm/vmscan.c
> index fd9de50..7e026ec 100644
> --- a/mm/vmscan.c
> +++ b/mm/vmscan.c
> @@ -1446,7 +1446,11 @@ static unsigned long shrink_page_list(struct list_head *page_list,
>
>                 unlock_page(page);
>  free_it:
> -               nr_reclaimed++;
> +               /*
> +                * THP may get swapped out in a whole, need account
> +                * all base pages.
> +                */
> +               nr_reclaimed += (1 << compound_order(page));
>
>                 /*
>                  * Is there need to periodically free_page_list? It would
> --
> 1.8.3.1
>


  reply	other threads:[~2019-05-10  0:40 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-10  0:16 Yang Shi
2019-05-10  0:39 ` Shakeel Butt [this message]
2019-05-10  2:12 ` Huang, Ying
2019-05-10  2:25   ` Yang Shi
2019-05-10  3:03     ` Huang, Ying
2019-05-10  4:33       ` William Kucharski
2019-05-10 15:48         ` Yang Shi
2019-05-10 15:41       ` Yang Shi
2019-05-10 16:36   ` Matthew Wilcox
2019-05-10 16:50     ` Yang Shi
2019-05-10 16:52       ` Matthew Wilcox
2019-05-10 16:54         ` Yang Shi
2019-05-10 22:54     ` Ira Weiny
2019-05-10 23:06       ` Matthew Wilcox
2019-05-11  4:09     ` Yafang Shao
2019-05-11 22:33     ` William Kucharski

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=CALvZod5LjCMxsPhbY68QRggFy4QjVsTDXh192PqSW6qsMCKknw@mail.gmail.com \
    --to=shakeelb@google.com \
    --cc=akpm@linux-foundation.org \
    --cc=hannes@cmpxchg.org \
    --cc=hughd@google.com \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mgorman@techsingularity.net \
    --cc=mhocko@suse.com \
    --cc=yang.shi@linux.alibaba.com \
    --cc=ying.huang@intel.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