linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Yang Shi <shy828301@gmail.com>
To: "Kirill A. Shutemov" <kirill@shutemov.name>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Michal Hocko <mhocko@kernel.org>, Linux MM <linux-mm@kvack.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
Subject: Re: [PATCH] mm, thp: Do not queue fully unmapped pages for deferred split
Date: Mon, 16 Sep 2019 10:22:18 -0700	[thread overview]
Message-ID: <CAHbLzkq7JT=KE9R_W6YfXmBJBeESgXZvdReS30sH8no63YQE0Q@mail.gmail.com> (raw)
In-Reply-To: <20190913091849.11151-1-kirill.shutemov@linux.intel.com>

On Fri, Sep 13, 2019 at 2:18 AM Kirill A. Shutemov <kirill@shutemov.name> wrote:
>
> Adding fully unmapped pages into deferred split queue is not productive:
> these pages are about to be freed or they are pinned and cannot be split
> anyway.

This change looks good to me. Reviewed-by: Yang Shi <yang.shi@linux.alibaba.com>

>
> Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
> ---
>  mm/rmap.c | 14 ++++++++++----
>  1 file changed, 10 insertions(+), 4 deletions(-)
>
> diff --git a/mm/rmap.c b/mm/rmap.c
> index 003377e24232..45388f1bf317 100644
> --- a/mm/rmap.c
> +++ b/mm/rmap.c
> @@ -1271,12 +1271,20 @@ static void page_remove_anon_compound_rmap(struct page *page)
>         if (TestClearPageDoubleMap(page)) {
>                 /*
>                  * Subpages can be mapped with PTEs too. Check how many of
> -                * themi are still mapped.
> +                * them are still mapped.
>                  */
>                 for (i = 0, nr = 0; i < HPAGE_PMD_NR; i++) {
>                         if (atomic_add_negative(-1, &page[i]._mapcount))
>                                 nr++;
>                 }
> +
> +               /*
> +                * Queue the page for deferred split if at least one small
> +                * page of the compound page is unmapped, but at least one
> +                * small page is still mapped.
> +                */
> +               if (nr && nr < HPAGE_PMD_NR)
> +                       deferred_split_huge_page(page);
>         } else {
>                 nr = HPAGE_PMD_NR;
>         }
> @@ -1284,10 +1292,8 @@ static void page_remove_anon_compound_rmap(struct page *page)
>         if (unlikely(PageMlocked(page)))
>                 clear_page_mlock(page);
>
> -       if (nr) {
> +       if (nr)
>                 __mod_node_page_state(page_pgdat(page), NR_ANON_MAPPED, -nr);
> -               deferred_split_huge_page(page);
> -       }
>  }
>
>  /**
> --
> 2.21.0
>
>

      parent reply	other threads:[~2019-09-16 17:22 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-13  9:18 [PATCH] mm, thp: Do not queue fully unmapped pages for deferred split Kirill A. Shutemov
2019-09-16 10:36 ` Michal Hocko
2019-09-16 11:11   ` Vlastimil Babka
2019-09-16 11:37     ` Michal Hocko
2019-09-16 17:22 ` Yang Shi [this message]

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='CAHbLzkq7JT=KE9R_W6YfXmBJBeESgXZvdReS30sH8no63YQE0Q@mail.gmail.com' \
    --to=shy828301@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=kirill@shutemov.name \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@kernel.org \
    /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).