All of lore.kernel.org
 help / color / mirror / Atom feed
From: Al Viro <viro@zeniv.linux.org.uk>
To: lkp@lists.01.org
Subject: Re: [x86] d55564cfc2: will-it-scale.per_thread_ops -5.8% regression
Date: Thu, 07 Jan 2021 18:58:16 +0000	[thread overview]
Message-ID: <20210107185816.GJ3579531@ZenIV.linux.org.uk> (raw)
In-Reply-To: <CAHk-=wiZaFRt9hGen9=eOr7LA+Q8o5f980eGEvtxBD6+os7nqA@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1124 bytes --]

On Thu, Jan 07, 2021 at 10:47:07AM -0800, Linus Torvalds wrote:
> On Thu, Jan 7, 2021 at 10:34 AM Al Viro <viro@zeniv.linux.org.uk> wrote:
> >
> > I'm not sure it's the best approach, TBH.  How about simply
> >         for (walk = head; walk; ufds += walk->len, walk = walk->next) {
> >                 if (copy_to_user(ufds, walk->entries,
> >                                  walk->len * sizeof(struct pollfd))
> >                         goto out_fds;
> >         }
> > in there?  It's both simpler (obviously matches the copyin side) and
> > might very well be faster...
> 
> I started doing that, but ..  Nope.
> 
> It's not copying the whole entry. It's literally just modifying one
> 16-bit word in each entry.
> 
> Now, the "whole entry" is just 8 bytes, so it's possible that it would
> actually be faster to do a copy of the whole thing rather than write
> just the 16 bits. But I got very nervous about it, because I could
> easily see some threaded app actually changing the 'fd' (or the
> 'event' field) in place (ie writing -1 to it as they close and re-use
> it)

Point...  Pity, that.

WARNING: multiple messages have this Message-ID (diff)
From: Al Viro <viro@zeniv.linux.org.uk>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: kernel test robot <oliver.sang@intel.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@kernel.org>, Borislav Petkov <bp@alien8.de>,
	Peter Zijlstra <peterz@infradead.org>,
	LKML <linux-kernel@vger.kernel.org>,
	lkp@lists.01.org, kernel test robot <lkp@intel.com>,
	"Huang, Ying" <ying.huang@intel.com>,
	Feng Tang <feng.tang@intel.com>,
	zhengjun.xing@intel.com
Subject: Re: [x86] d55564cfc2: will-it-scale.per_thread_ops -5.8% regression
Date: Thu, 7 Jan 2021 18:58:16 +0000	[thread overview]
Message-ID: <20210107185816.GJ3579531@ZenIV.linux.org.uk> (raw)
In-Reply-To: <CAHk-=wiZaFRt9hGen9=eOr7LA+Q8o5f980eGEvtxBD6+os7nqA@mail.gmail.com>

On Thu, Jan 07, 2021 at 10:47:07AM -0800, Linus Torvalds wrote:
> On Thu, Jan 7, 2021 at 10:34 AM Al Viro <viro@zeniv.linux.org.uk> wrote:
> >
> > I'm not sure it's the best approach, TBH.  How about simply
> >         for (walk = head; walk; ufds += walk->len, walk = walk->next) {
> >                 if (copy_to_user(ufds, walk->entries,
> >                                  walk->len * sizeof(struct pollfd))
> >                         goto out_fds;
> >         }
> > in there?  It's both simpler (obviously matches the copyin side) and
> > might very well be faster...
> 
> I started doing that, but ..  Nope.
> 
> It's not copying the whole entry. It's literally just modifying one
> 16-bit word in each entry.
> 
> Now, the "whole entry" is just 8 bytes, so it's possible that it would
> actually be faster to do a copy of the whole thing rather than write
> just the 16 bits. But I got very nervous about it, because I could
> easily see some threaded app actually changing the 'fd' (or the
> 'event' field) in place (ie writing -1 to it as they close and re-use
> it)

Point...  Pity, that.

  reply	other threads:[~2021-01-07 18:58 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-07 13:47 [x86] d55564cfc2: will-it-scale.per_thread_ops -5.8% regression kernel test robot
2021-01-07 13:47 ` kernel test robot
2021-01-07 17:43 ` Linus Torvalds
2021-01-07 17:43   ` Linus Torvalds
2021-01-07 18:33   ` Al Viro
2021-01-07 18:33     ` Al Viro
2021-01-07 18:40     ` Al Viro
2021-01-07 18:40       ` Al Viro
2021-01-07 18:55       ` Al Viro
2021-01-07 18:55         ` Al Viro
2021-01-07 18:47     ` Linus Torvalds
2021-01-07 18:47       ` Linus Torvalds
2021-01-07 18:58       ` Al Viro [this message]
2021-01-07 18:58         ` Al Viro
2021-01-07 19:04       ` Al Viro
2021-01-07 19:04         ` Al Viro
2021-01-07 19:33         ` Linus Torvalds
2021-01-07 19:33           ` Linus Torvalds
2021-01-07 19:57           ` Al Viro
2021-01-07 19:57             ` Al Viro
2021-01-08  9:29             ` David Laight
2021-01-08  9:29               ` David Laight
2021-01-08  9:37           ` David Laight
2021-01-08  9:37             ` David Laight
2021-01-08  9:51             ` Peter Zijlstra
2021-01-08  9:51               ` Peter Zijlstra
2021-01-08 10:44               ` David Laight
2021-01-08 10:44                 ` David Laight
2021-01-08  9:49     ` David Laight
2021-01-08  9:49       ` David Laight
2021-01-08  6:13   ` Oliver Sang
2021-01-08  6:13     ` Oliver Sang

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=20210107185816.GJ3579531@ZenIV.linux.org.uk \
    --to=viro@zeniv.linux.org.uk \
    --cc=lkp@lists.01.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.