[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200218182041.GB24185@bombadil.infradead.org>
Date: Tue, 18 Feb 2020 10:20:41 -0800
From: Matthew Wilcox <willy@...radead.org>
To: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: Andrei Vagin <avagin@...il.com>,
LKML <linux-kernel@...r.kernel.org>,
Sasha Levin <sashal@...nel.org>,
stable <stable@...r.kernel.org>,
Josh Triplett <josh@...htriplett.org>,
linux-fsdevel <linux-fsdevel@...r.kernel.org>
Subject: Re: [PATCH AUTOSEL 5.5 542/542] pipe: use exclusive waits when
reading or writing
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()?
Powered by blists - more mailing lists