linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Barry Song <baohua@kernel.org>
To: Lance Yang <ioworker0@gmail.com>
Cc: Matthew Wilcox <willy@infradead.org>,
	dev.jain@arm.com, akpm@linux-foundation.org,  david@redhat.com,
	ryan.roberts@arm.com, anshuman.khandual@arm.com,
	 hughd@google.com, wangkefeng.wang@huawei.com,
	baolin.wang@linux.alibaba.com,  gshan@redhat.com,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org
Subject: Re: [PATCH] mm: Compute mTHP order efficiently
Date: Tue, 17 Sep 2024 13:35:19 +0800	[thread overview]
Message-ID: <CAGsJ_4wKJLiFxO+8iEz1yo7GyGcYx6Uqwwe-Q3xMe8nr0Hr7BA@mail.gmail.com> (raw)
In-Reply-To: <CAK1f24kda+T9JRef7fZz0BEQj8+cabJ-+rG7UOhQZJsj4yExHw@mail.gmail.com>

On Tue, Sep 17, 2024 at 11:36 AM Lance Yang <ioworker0@gmail.com> wrote:
>
> On Mon, Sep 16, 2024 at 9:25 PM Matthew Wilcox <willy@infradead.org> wrote:
> >
> > On Fri, Sep 13, 2024 at 02:49:02PM +0530, Dev Jain wrote:
> > > We use pte_range_none() to determine whether contiguous PTEs are empty
> > > for an mTHP allocation. Instead of iterating the while loop for every
> > > order, use some information, which is the first set PTE found, from the
> > > previous iteration, to eliminate some cases. The key to understanding
> > > the correctness of the patch is that the ranges we want to examine
> > > form a strictly decreasing sequence of nested intervals.
> >
> > This is a lot more complicated.  Do you have any numbers that indicate
> > that it's faster?  Yes, it's fewer memory references, but you've gone
> > from a simple linear scan that's easy to prefetch to an exponential scan
> > that might confuse the prefetchers.
>
> +1
>
> I'm not sure if multiple mthp sizes will be enabled for common cases ;)
> If not, this could be a bit more complicated, IMO.
>
> @Barry, could you share whether OPPO typically uses multiple mthp sizes
> in their scenarios?

not at all. I actually doubt we really wanted to enable multiple sizes at
the same time.

but somehow, i like the idea to make pte_range_none() non-bool(to be
consistent with all other places we are checking pte/swap_xxx_batch()
!= nr_pages). Personally, I don't care about the overhead of doing PTE
scanning too much. so i'd like having patch1 converting to non-bool, for
patch2 which might/might not reduce overhead, i don't care too much.

>
> Thanks,
> Lance

Thanks
Barry


  reply	other threads:[~2024-12-05 15:19 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-13  9:19 Dev Jain
2024-09-16  5:12 ` Barry Song
2024-09-16  5:20   ` Dev Jain
2024-09-16  5:58     ` Barry Song
2024-09-16 13:24 ` Matthew Wilcox
2024-09-17  3:35   ` Lance Yang
2024-09-17  5:35     ` Barry Song [this message]
2024-09-17  3:55   ` Dev Jain
2024-09-17  8:29     ` Ryan Roberts
2024-09-17  8:44       ` Barry Song
2024-09-17  8:54         ` Ryan Roberts
2024-09-17  9:09           ` Barry Song
2024-09-17 10:19             ` Ryan Roberts
2024-09-17 10:12     ` David Hildenbrand

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_4wKJLiFxO+8iEz1yo7GyGcYx6Uqwwe-Q3xMe8nr0Hr7BA@mail.gmail.com \
    --to=baohua@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=anshuman.khandual@arm.com \
    --cc=baolin.wang@linux.alibaba.com \
    --cc=david@redhat.com \
    --cc=dev.jain@arm.com \
    --cc=gshan@redhat.com \
    --cc=hughd@google.com \
    --cc=ioworker0@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=ryan.roberts@arm.com \
    --cc=wangkefeng.wang@huawei.com \
    --cc=willy@infradead.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