linux-security-module.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Linus Torvalds <torvalds@linux-foundation.org>
To: David Howells <dhowells@redhat.com>
Cc: Rasmus Villemoes <linux@rasmusvillemoes.dk>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Nicolas Dichtel <nicolas.dichtel@6wind.com>,
	raven@themaw.net, Christian Brauner <christian@brauner.io>,
	keyrings@vger.kernel.org, linux-usb@vger.kernel.org,
	linux-block <linux-block@vger.kernel.org>,
	LSM List <linux-security-module@vger.kernel.org>,
	linux-fsdevel <linux-fsdevel@vger.kernel.org>,
	Linux API <linux-api@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [RFC PATCH 00/11] pipe: Notification queue preparation [ver #3]
Date: Fri, 1 Nov 2019 12:24:54 -0700	[thread overview]
Message-ID: <CAHk-=wjqx4j2vqg-tAwthNP1gcAcj1x4B7sq6Npbi8QJTUMd-A@mail.gmail.com> (raw)
In-Reply-To: <157262963995.13142.5568934007158044624.stgit@warthog.procyon.org.uk>

On Fri, Nov 1, 2019 at 10:34 AM David Howells <dhowells@redhat.com> wrote:
>  (1) It removes the nr_exclusive argument from __wake_up_sync_key() as this
>      is always 1.  This prepares for step 2.
>
>  (2) Adds wake_up_interruptible_sync_poll_locked() so that poll can be
>      woken up from a function that's holding the poll waitqueue spinlock.

Side note: we have a couple of cases where I don't think we should use
the "sync" version at all.

Both pipe_read() and pipe_write() have that

        if (do_wakeup) {
                wake_up_interruptible_sync_poll(&pipe->wait, ...

code at the end, outside the loop. But those two wake-ups aren't
actually synchronous.

A sync wake is supposedly something where the waker is just about to
go to sleep, telling the scheduler that "don't bother trying to pick
another cpu, this process is going to sleep and you can stay here".

I'm not sure how much this matters, but it does strike me that it's
wrong. We're not going to sleep at all in that case - this is not the
"I filled the whole buffer, so I'm going to sleep" case (or the "I've
read all the data, I'm waiting for more".

It's entirely possible that we always wake pipe wakeups to be sync
just because it's a common pattern (and a common benchmark), but this
series made me look at it again. Particularly since David has
benchmarks that don't seem to show a lot of fluctuation with his
changes - I wonder how much the sync logic buys us (or hurts us)?

               Linus

  parent reply	other threads:[~2019-11-01 19:25 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-01 17:34 [RFC PATCH 00/11] pipe: Notification queue preparation [ver #3] David Howells
2019-11-01 17:34 ` [RFC PATCH 01/11] pipe: Reduce #inclusion of pipe_fs_i.h " David Howells
2019-11-01 17:34 ` [RFC PATCH 02/11] Remove the nr_exclusive argument from __wake_up_sync_key() " David Howells
2019-11-01 17:34 ` [RFC PATCH 03/11] Add wake_up_interruptible_sync_poll_locked() " David Howells
2019-11-01 17:34 ` [RFC PATCH 04/11] pipe: Use head and tail pointers for the ring, not cursor and length " David Howells
     [not found]   ` <20191107090306.GV29418@shao2-debian>
2019-11-07 16:51     ` [pipe] d60337eff1: phoronix-test-suite.noise-level.0.activity_level 144.0% improvement Linus Torvalds
2019-11-07 17:42     ` David Howells
2019-11-01 17:34 ` [RFC PATCH 05/11] pipe: Allow pipes to have kernel-reserved slots [ver #3] David Howells
2019-11-01 17:34 ` [RFC PATCH 06/11] pipe: Advance tail pointer inside of wait spinlock in pipe_read() " David Howells
2019-11-01 17:35 ` [RFC PATCH 07/11] pipe: Conditionalise wakeup " David Howells
2019-11-01 17:35 ` [RFC PATCH 08/11] pipe: Rearrange sequence in pipe_write() to preallocate slot " David Howells
2019-11-01 17:35 ` [RFC PATCH 09/11] pipe: Remove redundant wakeup from pipe_write() " David Howells
2019-11-01 17:35 ` [RFC PATCH 10/11] pipe: Check for ring full inside of the spinlock in " David Howells
2019-11-01 17:35 ` [RFC PATCH 11/11] pipe: Increase the writer-wakeup threshold to reduce context-switch count " David Howells
2019-11-01 19:24 ` Linus Torvalds [this message]
2019-11-01 22:05 ` [RFC PATCH 00/11] pipe: Notification queue preparation " David Howells
2019-11-01 22:12   ` Linus Torvalds
2019-11-05 16:02 ` Details on the UAPI of implementing notifications on pipes David Howells

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='CAHk-=wjqx4j2vqg-tAwthNP1gcAcj1x4B7sq6Npbi8QJTUMd-A@mail.gmail.com' \
    --to=torvalds@linux-foundation.org \
    --cc=christian@brauner.io \
    --cc=dhowells@redhat.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=keyrings@vger.kernel.org \
    --cc=linux-api@vger.kernel.org \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=linux@rasmusvillemoes.dk \
    --cc=nicolas.dichtel@6wind.com \
    --cc=peterz@infradead.org \
    --cc=raven@themaw.net \
    /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).