From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.9 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C8792CA9EBD for ; Sun, 27 Oct 2019 14:03:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9DC9D20679 for ; Sun, 27 Oct 2019 14:03:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1572185036; bh=SF8ID9dlHeFbRYwBzozNy7Dlal4q4YlkPN2xgNlo7gQ=; h=References:In-Reply-To:From:Date:Subject:To:Cc:List-ID:From; b=fRMUpyb07xnbVmx4vcIa547dRzuSgfwMsiOlGz99jIzLzHC9E8xfQiJK86BbCZ8bP VWu71xxbXPzmUNAlO8a94RadrVG/dRZw1nR62qM43K7i15xuzjkIawdy7GY+dtk7l/ qWEOuRvmdYFvC4HIxQyrGbHfYr9MzKMCyNSswg90= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726823AbfJ0ODz (ORCPT ); Sun, 27 Oct 2019 10:03:55 -0400 Received: from mail-lj1-f195.google.com ([209.85.208.195]:38162 "EHLO mail-lj1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726687AbfJ0ODz (ORCPT ); Sun, 27 Oct 2019 10:03:55 -0400 Received: by mail-lj1-f195.google.com with SMTP id q78so8568984lje.5 for ; Sun, 27 Oct 2019 07:03:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=aUtxqBrTqUG2JQM67qlbeu/gWrmsCKLHs/nf3HjwR6o=; b=UBVoDLidxhGRZnO3t3s9odW+975NWscpsgyn72pMoIFtMXrLI8gYCDX8RoEk4dUGpu XShVkulYmvYa4f4vPiGJkAOAAjj/NBHXSLZISLlhGaOzl5SAbZ6BhT9CpKJEgEzb8LhN G2c7dQQvyPPapIvGT5FeHB9zbcHI3CN4A0Ff0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=aUtxqBrTqUG2JQM67qlbeu/gWrmsCKLHs/nf3HjwR6o=; b=pjJtU5xk+M2Xxhbtap4iD52OqsfKYRqwDY+bUWIpmDTlUgNyHKdzVh5Fgsv6ZRbtRf dLPnpPCtpzSUC9ECfhSNqgz5//JOBpOvTfneglPWByMxJzhKa1BFKa48ZajiKuLYlt4S ro1tXLDrfHgp9Wh11n3ft0Iyj63fhwF3UgyASXI0G4/fBx1SxXwvl8od97iGyY6aq6tD m+9xec1Ilft38zLBqXVUlzaYZdt3bsRzZvrIaShDJMOgw3qYP39EnWuqjxmyYeFOrmMr 5BCQkrd6eZO21KiYSWfRPCo9S9d19jpmlExEwhERyr/nuypxpMIKZUZe9xteEMJTZI2z yGfg== X-Gm-Message-State: APjAAAUlBxj4xIuSSNhVGwhG8udQb3CdcmdJulnnTu3zyNbwti8Tvoux lH24O/KXTBTsz/PlgTfT4lWaoIV2EUCW5w== X-Google-Smtp-Source: APXvYqzHz0lHMKtGgtV/S9KiPBJL3wUGA+rPXOcwm9SWf3XNCkwSJQmMmDU12a9eLWCNqsKAfPRiig== X-Received: by 2002:a2e:7405:: with SMTP id p5mr8715432ljc.191.1572185033137; Sun, 27 Oct 2019 07:03:53 -0700 (PDT) Received: from mail-lj1-f182.google.com (mail-lj1-f182.google.com. [209.85.208.182]) by smtp.gmail.com with ESMTPSA id w20sm5301877lff.46.2019.10.27.07.03.52 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 27 Oct 2019 07:03:52 -0700 (PDT) Received: by mail-lj1-f182.google.com with SMTP id l21so8566941lje.4 for ; Sun, 27 Oct 2019 07:03:52 -0700 (PDT) X-Received: by 2002:a05:651c:331:: with SMTP id b17mr8760744ljp.133.1572185032112; Sun, 27 Oct 2019 07:03:52 -0700 (PDT) MIME-Version: 1.0 References: <157186182463.3995.13922458878706311997.stgit@warthog.procyon.org.uk> <157186186167.3995.7568100174393739543.stgit@warthog.procyon.org.uk> In-Reply-To: <157186186167.3995.7568100174393739543.stgit@warthog.procyon.org.uk> From: Linus Torvalds Date: Sun, 27 Oct 2019 10:03:35 -0400 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [RFC PATCH 04/10] pipe: Use head and tail pointers for the ring, not cursor and length [ver #2] 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 Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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