linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Barry Song <21cnbao@gmail.com>
To: Ryan Roberts <ryan.roberts@arm.com>
Cc: David Hildenbrand <david@redhat.com>,
	Lance Yang <ioworker0@gmail.com>,
	 Vishal Moola <vishal.moola@gmail.com>,
	akpm@linux-foundation.org, zokeefe@google.com,
	 shy828301@gmail.com, mhocko@suse.com, fengwei.yin@intel.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 v2 1/1] mm/madvise: enhance lazyfreeing with mTHP in madvise_free
Date: Mon, 11 Mar 2024 18:01:14 +0800	[thread overview]
Message-ID: <CAGsJ_4xWyA1qtTR=iNukJ7=RqqJAxc2hXZSX6LtP3WbcEK5g9Q@mail.gmail.com> (raw)
In-Reply-To: <37bc1a30-7613-4404-b123-c351e36fc800@arm.com>

On Mon, Mar 11, 2024 at 5:55 PM Ryan Roberts <ryan.roberts@arm.com> wrote:
>
> [...]
>
> >>>>> we don't want reclamation overhead later. and we want memories immediately
> >>>>> available to others.
> >>>>
> >>>> But by that logic, you also don't want to leave the large folio partially mapped
> >>>> all the way until the last subpage is CoWed. Surely you would want to reclaim it
> >>>> when you reach partial map status?
> >>>
> >>> To some extent, I agree. But then we will have two many copies. The last
> >>> subpage is small, and a safe place to copy instead.
> >>>
> >>> We actually had to tune userspace to decrease partial map as too much
> >>> partial map both unfolded CONT-PTE and wasted too much memory. if a
> >>> vma had too much partial map, we disabled mTHP on this VMA.
> >>
> >> I actually had a whacky idea around introducing selectable page size ABI
> >> per-process that might help here. I know Android is doing work to make the
> >> system 16K page compatible. You could run most of the system processes with 16K
> >> ABI on top of 4K kernel. Then those processes don't even have the ability to
> >> madvise/munmap/mprotect/mremap anything less than 16K alignment so that acts as
> >> an anti-fragmentation mechanism while allowing non-16K capable processes to run
> >> side-by-side. Just a passing thought...
> >
> > Right, this project faces a challenge in supporting legacy
> > 4KiB-aligned applications.
> > but I don't find it will be an issue to run 16KiB-aligned applications
> > on a kernel whose
> > page size is 4KiB.
>
> Yes, agreed that a 16K-aligned (or 64K-aligned) app will work without issue on
> 4K kernel, but it will also use getpagesize() and know what the page size is.
> I'm suggesting you could actually run these apps on a 4K kernel but with a 16K
> ABI and potentially get close to the native 16K performance out of them. It's
> just a thought though - I don't have any data that actually shows this is better
> than just running on a 4K kernel with a 4K ABI, and using 16K or 64K mTHP
> opportunistically.

 I fully agree with this as my Ubuntu filesystem can run on 4KiB, 16KiB and
64KiB basepage size as its elf files are 64KiB aligned. so I would expect
new Android apps/middleware move to 64KiB ABI though it might want to
change the base page size to 16KiB instead.
I believe this is the case.

Thanks
Barry


  reply	other threads:[~2024-03-11 10:01 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-07  6:14 Lance Yang
2024-03-07  7:00 ` Barry Song
2024-03-07  8:00   ` Lance Yang
2024-03-07  8:10     ` Barry Song
2024-03-07  9:07       ` Ryan Roberts
2024-03-07  9:33         ` Barry Song
2024-03-07 10:50           ` Ryan Roberts
2024-03-07 10:54             ` David Hildenbrand
2024-03-07 10:54               ` David Hildenbrand
2024-03-07 11:13                 ` Ryan Roberts
2024-03-07 11:17                   ` David Hildenbrand
2024-03-07 14:41                     ` Lance Yang
2024-03-07 14:58                       ` David Hildenbrand
2024-03-07 15:08                         ` Lance Yang
2024-03-07 11:26                   ` Barry Song
2024-03-07 11:31                     ` David Hildenbrand
2024-03-07 11:42                       ` Ryan Roberts
2024-03-07 11:45                         ` David Hildenbrand
2024-03-07 12:01                           ` Barry Song
2024-03-07 12:04                             ` David Hildenbrand
2024-03-07 16:31                             ` Ryan Roberts
2024-03-07 18:54                               ` Barry Song
2024-03-07 19:48                                 ` David Hildenbrand
2024-03-08 13:05                                 ` Ryan Roberts
2024-03-08 13:27                                   ` David Hildenbrand
2024-03-08 13:48                                     ` Ryan Roberts
2024-03-08 18:01                                   ` Barry Song
2024-03-11  9:55                                     ` Ryan Roberts
2024-03-11 10:01                                       ` Barry Song [this message]
2024-03-11 15:07         ` Ryan Roberts
2024-03-12 10:20           ` Lance Yang

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='CAGsJ_4xWyA1qtTR=iNukJ7=RqqJAxc2hXZSX6LtP3WbcEK5g9Q@mail.gmail.com' \
    --to=21cnbao@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=david@redhat.com \
    --cc=fengwei.yin@intel.com \
    --cc=ioworker0@gmail.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=vishal.moola@gmail.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