linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Lance Yang <ioworker0@gmail.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: ryan.roberts@arm.com, david@redhat.com, 21cnbao@gmail.com,
	mhocko@suse.com,  fengwei.yin@intel.com, zokeefe@google.com,
	shy828301@gmail.com,  xiehuan09@gmail.com,
	wangkefeng.wang@huawei.com, songmuchun@bytedance.com,
	 peterx@redhat.com, minchan@kernel.org, linux-mm@kvack.org,
	 linux-kernel@vger.kernel.org
Subject: Re: [PATCH v5 0/2] mm/madvise: enhance lazyfreeing with mTHP in madvise_free
Date: Thu, 11 Apr 2024 13:01:22 +0800	[thread overview]
Message-ID: <CAK1f24nfN_cfdKn_q391NAug-dvWsX-LW9NzxcTaRm95Px3Kqw@mail.gmail.com> (raw)
In-Reply-To: <20240410145033.5cdb8a41f3a6894a62191f42@linux-foundation.org>

On Thu, Apr 11, 2024 at 5:50 AM Andrew Morton <akpm@linux-foundation.org> wrote:
>
> On Mon,  8 Apr 2024 12:24:35 +0800 Lance Yang <ioworker0@gmail.com> wrote:
>
> > Hi All,
> >
> > This patchset adds support for lazyfreeing multi-size THP (mTHP) without
> > needing to first split the large folio via split_folio(). However, we
> > still need to split a large folio that is not fully mapped within the
> > target range.
> >
> > If a large folio is locked or shared, or if we fail to split it, we just
> > leave it in place and advance to the next PTE in the range. But note that
> > the behavior is changed; previously, any failure of this sort would cause
> > the entire operation to give up. As large folios become more common,
> > sticking to the old way could result in wasted opportunities.
> >
> > Performance Testing
> > ===================
> >
> > On an Intel I5 CPU, lazyfreeing a 1GiB VMA backed by PTE-mapped folios of
> > the same size results in the following runtimes for madvise(MADV_FREE)
> > in seconds (shorter is better):
> >
> > Folio Size |   Old    |   New    | Change
> > ------------------------------------------
> >       4KiB | 0.590251 | 0.590259 |    0%
> >      16KiB | 2.990447 | 0.185655 |  -94%
> >      32KiB | 2.547831 | 0.104870 |  -95%
> >      64KiB | 2.457796 | 0.052812 |  -97%
> >     128KiB | 2.281034 | 0.032777 |  -99%
> >     256KiB | 2.230387 | 0.017496 |  -99%
> >     512KiB | 2.189106 | 0.010781 |  -99%
> >    1024KiB | 2.183949 | 0.007753 |  -99%
> >    2048KiB | 0.002799 | 0.002804 |    0%
>
> That looks nice but punting work to another thread can slightly
> increase overall system load and can mess up utilization accounting by
> attributing work to threads which didn't initiate that work.
>
> And there's a corner-case risk where the thread running madvise() has
> realtime policy (SCHED_RR/SCHED_FIFO) on a single-CPU system,
> preventing any other threads from executing, resulting in indefinitely
> deferred freeing resulting in memory squeezes or even OOM conditions.
>
> It would be good if the changelog(s) were to show some consideration of
> such matters and some demonstration that the benefits exceed the risks
> and costs.
>

Hey Andrew,

Thanks for bringing up these concerns!

I completely agree that we need to consider such masters and include
them into the changelog(s). Additionally, I'll do my best to show that the
benefits exceed the risks and costs, and then update the changelog(s)
accordingly.

Thanks again for your time!
Lance


  reply	other threads:[~2024-04-11  5:01 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-08  4:24 Lance Yang
2024-04-08  4:24 ` [PATCH v5 1/2] mm/madvise: optimize " Lance Yang
2024-04-11 11:11   ` Ryan Roberts
2024-04-11 11:20     ` David Hildenbrand
2024-04-11 11:27       ` Ryan Roberts
2024-04-11 12:23         ` Lance Yang
2024-04-11 13:51           ` Ryan Roberts
2024-04-11 13:55             ` David Hildenbrand
2024-04-11 12:46     ` Lance Yang
2024-04-11 13:48       ` Ryan Roberts
2024-04-11 14:07         ` Lance Yang
2024-04-11 14:39           ` Ryan Roberts
2024-04-11 14:42             ` David Hildenbrand
2024-04-12  1:48             ` Lance Yang
2024-04-08  4:24 ` [PATCH v5 2/2] mm/arm64: override mkold_clean_ptes() batch helper Lance Yang
2024-04-11 13:17   ` Ryan Roberts
2024-04-12  2:09     ` Lance Yang
2024-04-12 11:21       ` Ryan Roberts
2024-04-10 21:50 ` [PATCH v5 0/2] mm/madvise: enhance lazyfreeing with mTHP in madvise_free Andrew Morton
2024-04-11  5:01   ` Lance Yang [this message]
2024-04-11 10:29     ` Ryan Roberts

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=CAK1f24nfN_cfdKn_q391NAug-dvWsX-LW9NzxcTaRm95Px3Kqw@mail.gmail.com \
    --to=ioworker0@gmail.com \
    --cc=21cnbao@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=david@redhat.com \
    --cc=fengwei.yin@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@suse.com \
    --cc=minchan@kernel.org \
    --cc=peterx@redhat.com \
    --cc=ryan.roberts@arm.com \
    --cc=shy828301@gmail.com \
    --cc=songmuchun@bytedance.com \
    --cc=wangkefeng.wang@huawei.com \
    --cc=xiehuan09@gmail.com \
    --cc=zokeefe@google.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