linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jann Horn <jannh@google.com>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: kernel test robot <rong.a.chen@intel.com>,
	Christoph Hellwig <hch@lst.de>, Oleg Nesterov <oleg@redhat.com>,
	Kirill Shutemov <kirill@shutemov.name>, Jan Kara <jack@suse.cz>,
	Andrea Arcangeli <aarcange@redhat.com>,
	Matthew Wilcox <willy@infradead.org>,
	LKML <linux-kernel@vger.kernel.org>,
	lkp@lists.01.org
Subject: Re: [gup] 17839856fd: stress-ng.vm-splice.ops_per_sec 2158.6% improvement
Date: Mon, 15 Jun 2020 09:32:41 +0200	[thread overview]
Message-ID: <CAG48ez1v1b4X5LgFya6nvi33-TWwqna_dc5jGFVosqQhdn_Nkg@mail.gmail.com> (raw)
In-Reply-To: <CAHk-=whCjhBgJv0z6JoOKMyfnBp0WhH6oa=ayuRRLtgJxOkd5Q@mail.gmail.com>

On Thu, Jun 11, 2020 at 10:24 PM Linus Torvalds
<torvalds@linux-foundation.org> wrote:
>
> On Wed, Jun 10, 2020 at 9:05 PM kernel test robot <rong.a.chen@intel.com> wrote:
> >
> > FYI, we noticed a 2158.6% improvement of stress-ng.vm-splice.ops_per_sec due to commit:
> >
> > commit: 17839856fd588f4ab6b789f482ed3ffd7c403e1f ("gup: document and work around "COW can break either way" issue")
>
> Well, that is amusing, and seeing improvements is always nice, but
> somehow I think the test is broken.
>
> I can't see why you'd ever see an improvement from that commit, and if
> you do see one, not one by a factor of 20x.

FWIW, if this is the testcase:
<https://kernel.ubuntu.com/git/cking/stress-ng.git/tree/stress-vm-splice.c>

then that testcase is essentially testing how fast vmsplice() is when
called in a loop on an uninitialized mmap() mapping. So before that
commit, I think it will create zeropage PTEs in the first iteration
(and zeropage PTEs are _PAGE_SPECIAL, see do_anonymous_page()). And
get_user_pages_fast() bails out in gup_pte_range() if pte_special().
So that testcase was always hitting the GUP slowpath.
But now the first iteration will force the creation of a normal RW
PTE, so all following iterations can go through the GUP fastpath.

So in summary I guess the test was just really slow up until now
because it was hitting a slowpath that you wouldn't hit during normal
usage? At least for vmsplice(), writing uninitialized pages doesn't
really make a whole lot of sense...

  parent reply	other threads:[~2020-06-15  7:33 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-11  4:04 [gup] 17839856fd: stress-ng.vm-splice.ops_per_sec 2158.6% improvement kernel test robot
2020-06-11 20:24 ` Linus Torvalds
2020-06-12  0:07   ` [LKP] " Philip Li
2020-06-15  6:58     ` Feng Tang
2020-06-15  7:32   ` Jann Horn [this message]
2020-06-15  8:33     ` Feng Tang
2020-06-15 19:09     ` Linus Torvalds

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=CAG48ez1v1b4X5LgFya6nvi33-TWwqna_dc5jGFVosqQhdn_Nkg@mail.gmail.com \
    --to=jannh@google.com \
    --cc=aarcange@redhat.com \
    --cc=hch@lst.de \
    --cc=jack@suse.cz \
    --cc=kirill@shutemov.name \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkp@lists.01.org \
    --cc=oleg@redhat.com \
    --cc=rong.a.chen@intel.com \
    --cc=torvalds@linux-foundation.org \
    --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;
as well as URLs for NNTP newsgroup(s).