Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp1900179ybg; Sun, 27 Oct 2019 07:05:15 -0700 (PDT) X-Google-Smtp-Source: APXvYqxQNKnJkGvFuLXtCuQorUz1nNnoVDSC7V1XjCenBw2iLAURLZrWF+sqlzEIt2zQJwmfqJ72 X-Received: by 2002:a17:906:2cca:: with SMTP id r10mr12593461ejr.108.1572185115066; Sun, 27 Oct 2019 07:05:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572185115; cv=none; d=google.com; s=arc-20160816; b=mvyPsZeYmuN4MW0fFlbUsh6+lRL2N9vNb9KEevWyXSMJp6XEUJb+5alQKuC8COPxhi I5WaW04LRzVKZwxm0K5AYaawIvZe4t1Qn8eBMBen8IeuXNhzEav+2I0+RweQTFrEziVL jUm8sL0TXQoTOqlrkUoGbh+F8MgeVfRRO99fz3R/ghy+08Nl+pSQKM3Cg8ZaPopBFakC iFcBXbWzdtNNbcXBToNVmO2OqlMxxttLWVK3bq+luhZAUWNmofGjPlQAtD5RSHBEw5YH ExBsVgLH/rMy71sr1jmxWAGBPEWe2H1/nSAxtQZ7p2N3ZuEb4H3/5y9eUqxQylmGV8zc ge3w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=aUtxqBrTqUG2JQM67qlbeu/gWrmsCKLHs/nf3HjwR6o=; b=SIOpkWAA/HatOnE8TBowm6KEc/6W7Tpw9SdK+Z/WfWYA+0FJ1O0GLVOPUNkBi9DQFw GHiMAPLLN4JGI0mzYs46tMa676W4hGKgZLIRqDNbn2wG1DRPltP4wfo7Bmw+QsRGKW7f /tQmz9YOT3wLclWmEXFMkLiHv81FhYvFGUun8XGPownZH7aSRhjuXeKlH0l+0Y8Wvyr0 YtkBEkT7Td2pJ6gntQeH3ADKa7WXd5b+AnBJy+44GwFyBeK2/oyvy1gkVmi0I+AEQQze PbBZl3WueHJNaptuAVivgK6zbJr96SBS8Zjx3i8i72QgJ+bnXxS3AY8Z4JRWKwETVfVE y8EQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=UBVoDLid; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f8si5534995edf.428.2019.10.27.07.04.42; Sun, 27 Oct 2019 07:05:15 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=UBVoDLid; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726804AbfJ0ODz (ORCPT + 99 others); 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-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