[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <27732.1567764557@warthog.procyon.org.uk>
Date: Fri, 06 Sep 2019 11:09:17 +0100
From: David Howells <dhowells@...hat.com>
To: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: dhowells@...hat.com, Ray Strode <rstrode@...hat.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Steven Whitehouse <swhiteho@...hat.com>,
Nicolas Dichtel <nicolas.dichtel@...nd.com>, raven@...maw.net,
keyrings@...r.kernel.org, linux-usb@...r.kernel.org,
linux-block <linux-block@...r.kernel.org>,
Christian Brauner <christian@...uner.io>,
LSM List <linux-security-module@...r.kernel.org>,
linux-fsdevel <linux-fsdevel@...r.kernel.org>,
Linux API <linux-api@...r.kernel.org>,
Linux List Kernel Mailing <linux-kernel@...r.kernel.org>,
Al Viro <viro@...iv.linux.org.uk>,
"Ray, Debarshi" <debarshi.ray@...il.com>,
Robbie Harwood <rharwood@...hat.com>
Subject: Re: Why add the general notification queue and its sources
Linus Torvalds <torvalds@...ux-foundation.org> wrote:
> But it's *literally* just finding the places that work with
> pipe->curbuf/nrbufs and making them use atomic updates.
No. It really isn't. That's two variables that describe the occupied section
of the buffer. Unless you have something like a 68020 with CAS2, or put them
next to each other so you can use CMPXCHG8, you can't do that.
They need converting to head/tail pointers first.
> They really would work with almost anything. You could even mix-and-match
> "data generated by kernel" and "data done by 'write()' or 'splice()' by a
> user process".
Imagine that userspace writes a large message and takes the mutex. At the
same time something in softirq context decides *it* wants to write a message -
it can't take the mutex and it can't wait, so the userspace write would have
to cause the kernel message to be dropped.
What I would have to do is make a write to a notification pipe go through
post_notification() and limit the size to the maximum for a single message.
Much easier to simply suppress writes and splices on pipes that have been set
up to be notification queues - at least for now.
David
Powered by blists - more mailing lists