All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Collingbourne <pcc@google.com>
To: Matthew Wilcox <willy@infradead.org>
Cc: John Hubbard <jhubbard@nvidia.com>,
	"Kirill A . Shutemov" <kirill@shutemov.name>,
	Andrew Morton <akpm@linux-foundation.org>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Evgenii Stepanov <eugenis@google.com>,
	Jann Horn <jannh@google.com>,
	Linux ARM <linux-arm-kernel@lists.infradead.org>,
	Linux Memory Management List <linux-mm@kvack.org>,
	kernel test robot <lkp@intel.com>,
	Linux API <linux-api@vger.kernel.org>,
	linux-doc@vger.kernel.org
Subject: Re: [PATCH v4] mm: introduce reference pages
Date: Fri, 16 Jul 2021 19:58:44 -0700	[thread overview]
Message-ID: <CAMn1gO63NgAM847X8O0mPEitVF1NYK3pGe1N9m_XRW=mSHbUTQ@mail.gmail.com> (raw)
In-Reply-To: <YNopY7n+DcEnLxn7@casper.infradead.org>

On Mon, Jun 28, 2021 at 12:57 PM Matthew Wilcox <willy@infradead.org> wrote:
>
> On Mon, Jun 28, 2021 at 12:44:22PM -0700, John Hubbard wrote:
> > On 6/28/21 12:33 PM, Matthew Wilcox wrote:
> > ...
> > >
> > > I wonder if single-byte captures enough of the useful possibilities.
> > > In the kernel we have memset32() and memset64() [1] so we could support
> > > a larger pattern than just an 8-bit byte.  It all depends what userspace
> > > would find useful.
> > >
> > > [1] Along with memset_p(), memset_l() and memset16() that aren't terribly
> > > relevant to this use case.  Although maybe memset_l() would be the right
> > > one to use since there probably aren't too many 32-bit apps that want
> > > a 64-bit pattern and memset64() might not be the fastest on a 32-bit
> > > kernel).
> > >
> >
> > And in fact, I'm also rather intrigued by doing something like 256 copies
> > of a 16-byte UUID, per 4KB page. In other words, there are *definitely*
> > useful patterns that are longer than a single byte, and it seems interesting
> > to support them here.
> >
> > Kirill's idea of an API that somehow allows various power of 2 patterns seems
> > like it would be nice, because then we don't have to pick a value that seems
> > good in 2021, but less good as time goes by, perhaps.
> >
> > Another thought is to use an entire 4KB page as the smallest pattern unit.
> > That would allow the maximum API flexibility, because the caller could
> > explicitly set every single byte in the page.
>
> That's what this patch does.  If it can be reduced to a pattern (in
> Peter's patch of a single byte; i'm proposing expanding that), then
> the page is filled with the pattern; otherwise we copy the reference
> page.

That sounds good. I propose that for now we only optimize the single
byte pattern and single MTE granule use cases, and allow future
expansion later via the size argument. Programs that use sizes with
optimizations only implemented on newer kernels will still work on
older kernels; they will just be faster on the new kernels.

Peter

WARNING: multiple messages have this Message-ID (diff)
From: Peter Collingbourne <pcc@google.com>
To: Matthew Wilcox <willy@infradead.org>
Cc: John Hubbard <jhubbard@nvidia.com>,
	"Kirill A . Shutemov" <kirill@shutemov.name>,
	 Andrew Morton <akpm@linux-foundation.org>,
	Catalin Marinas <catalin.marinas@arm.com>,
	 Evgenii Stepanov <eugenis@google.com>,
	Jann Horn <jannh@google.com>,
	 Linux ARM <linux-arm-kernel@lists.infradead.org>,
	 Linux Memory Management List <linux-mm@kvack.org>,
	kernel test robot <lkp@intel.com>,
	 Linux API <linux-api@vger.kernel.org>,
	linux-doc@vger.kernel.org
Subject: Re: [PATCH v4] mm: introduce reference pages
Date: Fri, 16 Jul 2021 19:58:44 -0700	[thread overview]
Message-ID: <CAMn1gO63NgAM847X8O0mPEitVF1NYK3pGe1N9m_XRW=mSHbUTQ@mail.gmail.com> (raw)
In-Reply-To: <YNopY7n+DcEnLxn7@casper.infradead.org>

On Mon, Jun 28, 2021 at 12:57 PM Matthew Wilcox <willy@infradead.org> wrote:
>
> On Mon, Jun 28, 2021 at 12:44:22PM -0700, John Hubbard wrote:
> > On 6/28/21 12:33 PM, Matthew Wilcox wrote:
> > ...
> > >
> > > I wonder if single-byte captures enough of the useful possibilities.
> > > In the kernel we have memset32() and memset64() [1] so we could support
> > > a larger pattern than just an 8-bit byte.  It all depends what userspace
> > > would find useful.
> > >
> > > [1] Along with memset_p(), memset_l() and memset16() that aren't terribly
> > > relevant to this use case.  Although maybe memset_l() would be the right
> > > one to use since there probably aren't too many 32-bit apps that want
> > > a 64-bit pattern and memset64() might not be the fastest on a 32-bit
> > > kernel).
> > >
> >
> > And in fact, I'm also rather intrigued by doing something like 256 copies
> > of a 16-byte UUID, per 4KB page. In other words, there are *definitely*
> > useful patterns that are longer than a single byte, and it seems interesting
> > to support them here.
> >
> > Kirill's idea of an API that somehow allows various power of 2 patterns seems
> > like it would be nice, because then we don't have to pick a value that seems
> > good in 2021, but less good as time goes by, perhaps.
> >
> > Another thought is to use an entire 4KB page as the smallest pattern unit.
> > That would allow the maximum API flexibility, because the caller could
> > explicitly set every single byte in the page.
>
> That's what this patch does.  If it can be reduced to a pattern (in
> Peter's patch of a single byte; i'm proposing expanding that), then
> the page is filled with the pattern; otherwise we copy the reference
> page.

That sounds good. I propose that for now we only optimize the single
byte pattern and single MTE granule use cases, and allow future
expansion later via the size argument. Programs that use sizes with
optimizations only implemented on newer kernels will still work on
older kernels; they will just be faster on the new kernels.

Peter

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2021-07-17  2:58 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-19  9:20 [PATCH v4] mm: introduce reference pages Peter Collingbourne
2021-06-19  9:20 ` Peter Collingbourne
2021-06-19  9:20 ` Peter Collingbourne
2021-06-28 12:24 ` Kirill A. Shutemov
2021-06-28 12:24   ` Kirill A. Shutemov
2021-07-17  2:58   ` Peter Collingbourne
2021-07-17  2:58     ` Peter Collingbourne
2021-07-17  2:58     ` Peter Collingbourne
2021-06-28 13:10 ` Matthew Wilcox
2021-06-28 13:10   ` Matthew Wilcox
2021-07-17  2:58   ` Peter Collingbourne
2021-07-17  2:58     ` Peter Collingbourne
2021-07-17  2:58     ` Peter Collingbourne
2021-06-28 19:33 ` Matthew Wilcox
2021-06-28 19:33   ` Matthew Wilcox
2021-06-28 19:44   ` John Hubbard
2021-06-28 19:44     ` John Hubbard
2021-06-28 19:56     ` Matthew Wilcox
2021-06-28 19:56       ` Matthew Wilcox
2021-07-17  2:58       ` Peter Collingbourne [this message]
2021-07-17  2:58         ` Peter Collingbourne
2021-07-17  2:58         ` Peter Collingbourne
2021-06-29  7:19 ` John Hubbard
2021-06-29  7:19   ` John Hubbard
2021-06-29 11:58   ` Matthew Wilcox
2021-06-29 11:58     ` Matthew Wilcox
2021-06-29 17:48     ` John Hubbard
2021-06-29 17:48       ` John Hubbard
2021-06-29 18:21       ` Matthew Wilcox
2021-06-29 18:21         ` Matthew Wilcox
2021-06-29 18:28         ` John Hubbard
2021-06-29 18:28           ` John Hubbard
2021-07-17  2:59   ` Peter Collingbourne
2021-07-17  2:59     ` Peter Collingbourne
2021-07-17  2:59     ` Peter Collingbourne
2021-07-19 20:47 ` David Hildenbrand
2021-07-19 20:47   ` David Hildenbrand
2021-07-19 20:50 ` David Hildenbrand
2021-07-19 20:50   ` David Hildenbrand
2021-07-19 22:26   ` Peter Collingbourne
2021-07-19 22:26     ` Peter Collingbourne
2021-07-19 22:26     ` Peter Collingbourne
2021-07-19 22:30     ` John Hubbard
2021-07-19 22:30       ` John Hubbard
2021-07-20  7:28     ` David Hildenbrand
2021-07-20  7:28       ` 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='CAMn1gO63NgAM847X8O0mPEitVF1NYK3pGe1N9m_XRW=mSHbUTQ@mail.gmail.com' \
    --to=pcc@google.com \
    --cc=akpm@linux-foundation.org \
    --cc=catalin.marinas@arm.com \
    --cc=eugenis@google.com \
    --cc=jannh@google.com \
    --cc=jhubbard@nvidia.com \
    --cc=kirill@shutemov.name \
    --cc=linux-api@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=lkp@intel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.