From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Howells Subject: Re: Why add the general notification queue and its sources Date: Fri, 06 Sep 2019 11:09:17 +0100 Message-ID: <27732.1567764557@warthog.procyon.org.uk> References: <156763534546.18676.3530557439501101639.stgit@warthog.procyon.org.uk> <17703.1567702907@warthog.procyon.org.uk> <5396.1567719164@warthog.procyon.org.uk> <14883.1567725508@warthog.procyon.org.uk> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Return-path: In-Reply-To: Content-ID: <27731.1567764557.1@warthog.procyon.org.uk> Sender: linux-kernel-owner@vger.kernel.org To: Linus Torvalds Cc: dhowells@redhat.com, Ray Strode , Greg Kroah-Hartman , Steven Whitehouse , Nicolas Dichtel , raven@themaw.net, keyrings@vger.kernel.org, linux-usb@vger.kernel.org, linux-block , Christian Brauner , LSM List , linux-fsdevel , Linux API , Linux List Kernel Mailing , Al Viro , "Ray, Debarshi" , Robbie Harwood List-Id: linux-api@vger.kernel.org Linus Torvalds 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