From mboxrd@z Thu Jan 1 00:00:00 1970 From: Linus Torvalds Subject: Re: [RFC PATCH 04/10] pipe: Use head and tail pointers for the ring, not cursor and length [ver #2] Date: Sun, 27 Oct 2019 10:03:35 -0400 Message-ID: References: <157186182463.3995.13922458878706311997.stgit@warthog.procyon.org.uk> <157186186167.3995.7568100174393739543.stgit@warthog.procyon.org.uk> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Return-path: In-Reply-To: <157186186167.3995.7568100174393739543.stgit@warthog.procyon.org.uk> Sender: linux-kernel-owner@vger.kernel.org To: David Howells Cc: Rasmus Villemoes , Greg Kroah-Hartman , Peter Zijlstra , Nicolas Dichtel , raven@themaw.net, Christian Brauner , keyrings@vger.kernel.org, linux-usb@vger.kernel.org, linux-block , LSM List , linux-fsdevel , Linux API , Linux Kernel Mailing List List-Id: linux-api@vger.kernel.org This still has signs of that earlier series: On Wed, Oct 23, 2019 at 4:17 PM David Howells wrote: > > if (rem >= ibuf->len) { > *obuf = *ibuf; > ibuf->ops = NULL; > - pipe->curbuf = (pipe->curbuf + 1) & (pipe->buffers - 1); > - pipe->nrbufs--; > + tail++; > + pipe_commit_read(pipe, tail); > } else { > if (!pipe_buf_get(pipe, ibuf)) > goto out_free; with those odd "pipe_commit_read/write()" helpers. They make no sense, and they don't make things more legible. It's shorter and more obvious to just write pipe->head = head; than it is to write pipe_commit_write(pipe, head); Even when the addition of the notifications, it's all under the pipe->wait.lock, so it's all just regular assignments. Now, if at some point it starts doing fancy lockless things, at _that_ point the updates might become more complex, but that's a potential future thing that wouldn't be relevant for a while, and isn't a reason to make the code more obscure now. Hmm? Linus