linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Yu Zhao <yuzhao@google.com>
To: Muchun Song <muchun.song@linux.dev>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	 Linux Memory Management List <linux-mm@kvack.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH mm-unstable v1] mm/hugetlb_vmemmap: batch HVO work when demoting
Date: Mon, 12 Aug 2024 16:42:19 -0600	[thread overview]
Message-ID: <CAOUHufY9dceDCGyGrQGBozFxZa13Ctgw25PenAbfzoJSEaNTkA@mail.gmail.com> (raw)
In-Reply-To: <C5E8EB48-1B4F-4C40-A580-8C99C128ACCD@linux.dev>

On Mon, Aug 12, 2024 at 3:40 AM Muchun Song <muchun.song@linux.dev> wrote:
>
>
>
> > On Aug 11, 2024, at 12:17, Yu Zhao <yuzhao@google.com> wrote:
> >
> > Batch the HVO work, including de-HVO of the source and HVO of the
> > destination hugeTLB folios, to speed up demotion.
> >
> > After commit bd225530a4c7 ("mm/hugetlb_vmemmap: fix race with
> > speculative PFN walkers"), each request of HVO or de-HVO, batched or
> > not, invokes synchronize_rcu() once. For example, when not batched,
> > demoting one 1GB hugeTLB folio to 512 2MB hugeTLB folios invokes
> > synchronize_rcu() 513 times (1 de-HVO plus 512 HVO requests), whereas
> > when batched, only twice (1 de-HVO plus 1 HVO request). And
> > performance between the two cases are significantly different, e.g.,
> >  echo 2048kB >/sys/kernel/mm/hugepages/hugepages-1048576kB/demote_size
> >  time echo 100 >/sys/kernel/mm/hugepages/hugepages-1048576kB/demote
> >
> > Before this patch:
> >  real     8m58.158s
> >  user     0m0.009s
> >  sys      0m5.900s
> >
> > After this patch:
> >  real     0m0.900s
> >  user     0m0.000s
> >  sys      0m0.851s
> >
> > Fixes: bd225530a4c7 ("mm/hugetlb_vmemmap: fix race with speculative PFN walkers")
> > Signed-off-by: Yu Zhao <yuzhao@google.com>
>
> Reviewed-by: Muchun Song <muchun.song@linux.dev>

Thanks!

I forgot to mention (in the commit message) that:

This patch changes the behavior of the `demote` interface
when de-HVO fails. Before, the interface aborts immediately upon
failure; now, it tries to finish an entire batch, meaning it can make
extra progress if the rest of the batch contains folios that do not
need to de-HVO.

Will post v2 to fix this.


      reply	other threads:[~2024-08-12 22:43 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-11  4:17 Yu Zhao
2024-08-12  9:40 ` Muchun Song
2024-08-12 22:42   ` Yu Zhao [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=CAOUHufY9dceDCGyGrQGBozFxZa13Ctgw25PenAbfzoJSEaNTkA@mail.gmail.com \
    --to=yuzhao@google.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=muchun.song@linux.dev \
    /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