linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@infradead.org>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Andrei Vagin <avagin@gmail.com>,
	LKML <linux-kernel@vger.kernel.org>,
	Sasha Levin <sashal@kernel.org>, stable <stable@vger.kernel.org>,
	Josh Triplett <josh@joshtriplett.org>,
	linux-fsdevel <linux-fsdevel@vger.kernel.org>
Subject: Re: [PATCH AUTOSEL 5.5 542/542] pipe: use exclusive waits when reading or writing
Date: Tue, 18 Feb 2020 10:20:41 -0800	[thread overview]
Message-ID: <20200218182041.GB24185@bombadil.infradead.org> (raw)
In-Reply-To: <CAHk-=wiaDvYHBt8oyZGOp2XwJW4wNXVAchqTFuVBvASTFx_KfA@mail.gmail.com>

On Tue, Feb 18, 2020 at 10:17:30AM -0800, Linus Torvalds wrote:
> @@ -722,9 +722,10 @@ pipe_release(struct inode *inode, struct file *file)
>  	if (file->f_mode & FMODE_WRITE)
>  		pipe->writers--;
>  
> -	if (pipe->readers || pipe->writers) {
> -		wake_up_interruptible_sync_poll(&pipe->rd_wait, EPOLLIN | EPOLLRDNORM | EPOLLERR | EPOLLHUP);
> -		wake_up_interruptible_sync_poll(&pipe->wr_wait, EPOLLOUT | EPOLLWRNORM | EPOLLERR | EPOLLHUP);
> +	/* Was that the last reader or writer, but not the other side? */
> +	if (!pipe->readers != !pipe->writers) {
> +		wake_up_interruptible_all(&pipe->rd_wait);
> +		wake_up_interruptible_all(&pipe->wr_wait);
>  		kill_fasync(&pipe->fasync_readers, SIGIO, POLL_IN);
>  		kill_fasync(&pipe->fasync_writers, SIGIO, POLL_OUT);
>  	}
> @@ -1026,8 +1027,8 @@ static int wait_for_partner(struct pipe_inode_info *pipe, unsigned int *cnt)
>  
>  static void wake_up_partner(struct pipe_inode_info *pipe)
>  {
> -	wake_up_interruptible(&pipe->rd_wait);
> -	wake_up_interruptible(&pipe->wr_wait);
> +	wake_up_interruptible_all(&pipe->rd_wait);
> +	wake_up_interruptible_all(&pipe->wr_wait);
>  }

You don't want to move wake_up_partner() up and call it from pipe_release()?


  reply	other threads:[~2020-02-18 18:20 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20200214154854.6746-1-sashal@kernel.org>
2020-02-14 15:48 ` [PATCH AUTOSEL 5.5 539/542] fuse: don't overflow LLONG_MAX with end offset Sasha Levin
2020-02-14 15:48 ` [PATCH AUTOSEL 5.5 542/542] pipe: use exclusive waits when reading or writing Sasha Levin
2020-02-18  9:51   ` Andrei Vagin
2020-02-18 17:36     ` Linus Torvalds
2020-02-18 17:54       ` Linus Torvalds
2020-02-18 18:17         ` Linus Torvalds
2020-02-18 18:20           ` Matthew Wilcox [this message]
2020-02-18 18:28             ` Linus Torvalds
2020-02-18 22:33               ` Andrei Vagin
2020-02-18 23:03                 ` Linus Torvalds
2020-03-05 18:19                   ` Andrei Vagin
2020-03-05 18:40                     ` Linus Torvalds
2020-03-05 19:54                       ` Andrei Vagin
2020-02-18 18:53   ` 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=20200218182041.GB24185@bombadil.infradead.org \
    --to=willy@infradead.org \
    --cc=avagin@gmail.com \
    --cc=josh@joshtriplett.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sashal@kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=torvalds@linux-foundation.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).