Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp1331273ybl; Wed, 18 Dec 2019 16:53:37 -0800 (PST) X-Google-Smtp-Source: APXvYqwTzx6EG5Mv9h3tiZF0RsLQ4HObFHv+UnrciBe+pHAV7lors+fzQvhyDkjhVt7muFAmLahH X-Received: by 2002:a9d:7ada:: with SMTP id m26mr5921874otn.111.1576716817117; Wed, 18 Dec 2019 16:53:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576716817; cv=none; d=google.com; s=arc-20160816; b=I+nrcCICo/T6ZiK+VBkFFTXYxTTwUrYNxEvzYG1LiXQpiW4xASZmB3XUdLySlm0DeS zA1nWzoJq5/oJAHFQxCzGkEFJG0DZzORq3y7OwjwEFeJgoUob1SNNUSglRJApIJaejkS R2QkM7+QROfU5B7YLQn4DZwSiMlnUjEg3o8Yd+iRLymBsGDnq/kQlODUMc9ER1LRg8h3 M5qrOieyQd3ftPNf782XX6OxwjTG7fa4TJCcwfTA2N5ZZPuuZaf4803MufyyKieJr5pr KDA72hafsn+bug55fhCABjNVLsOijfyAl1ZQbq8aE5fNKudJVYXvTvQl0iC2FcSOq7vQ ug/g== 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=XwJOrPvdC/OUnIx0D6OjuNWpdSOqNbwus7db7UF6FVU=; b=EM5cOisoYaFHof3HlxrdtXgkktPb58WvYaYprKV3mkJKSiAta92FPYcZuFhGzVbMq/ 50VXO5yTFcDyswXtjN1m4EaGXAJ2fe/pVE1odMa5V0G7JCj2tkSAZ6D3OlJ1K6EpPp8E /HU852pmnXoaTWmfy+OzzpOfZ5aZJfZGd55K/LTgejXg9en7PkZAA7IddKJNgeN2msmX NePLA476tPQ7GuR0No9TOjfaZPu1IZC0UVcGkNeLHQ5ZsHODbg0Z1EU4+uT8dnTk7x4a lz6thwyN0zq4Nu3vOvegan8u+Xa2x0LayaABxR0B+ToJXeaiLJ5grscnj+c883E4Wdkd v2sQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=Nl5szeDV; 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 p11si2342147ota.300.2019.12.18.16.53.25; Wed, 18 Dec 2019 16:53:37 -0800 (PST) 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=Nl5szeDV; 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 S1726721AbfLSAvr (ORCPT + 99 others); Wed, 18 Dec 2019 19:51:47 -0500 Received: from mail-lf1-f68.google.com ([209.85.167.68]:37742 "EHLO mail-lf1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726536AbfLSAvr (ORCPT ); Wed, 18 Dec 2019 19:51:47 -0500 Received: by mail-lf1-f68.google.com with SMTP id b15so3063248lfc.4 for ; Wed, 18 Dec 2019 16:51:46 -0800 (PST) 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=XwJOrPvdC/OUnIx0D6OjuNWpdSOqNbwus7db7UF6FVU=; b=Nl5szeDVZvUT71nMP156KqkEP8YHndvFSlJCEiPDHzbV5vK5/s3HiS6NiImDS5R5cN Iy+cr0WDd6qL9kXmukbM0acwscQlGDkRF0HR0pWYJBQ0rljJpxJvxat9H5+HxFR0Ib9C jge2AHNXRjmluquEn00EdhqyX1BwD/AfPX6vs= 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=XwJOrPvdC/OUnIx0D6OjuNWpdSOqNbwus7db7UF6FVU=; b=Yf1dJjFdsW5FW15HalMj9EnXtwj4PQObNmpKhx8v8cvjji/JIEbA7g1S5HU97CvZoz sdqFF+qnr/lbbDKFhh2A+vRRYR68OlDnISgVRiooY7ybU3BwwQRcRczPnzICpg7XsIs5 s155QD5DAGB4AYQvQXndCa3RtsCArunanS7wjSAzrp05pGkqwT2MJU2Z5gTcbw/2e8Ub 01hPbETtF/VTk/c9emJM5Q5zs6PsIkR/M0B2ZwfXr5szDySoO2oyqJ6xPesGGOWEChJ3 vrs5TqeiD6xLARWHL4TAXf+zZWImJrPKeIajA5KjjypebfqSDbCxJ5i8e0j2TdCGxVh1 47VQ== X-Gm-Message-State: APjAAAW8kTYyMtj/St2uvoDld4uuYLzfXz17B8qinUugrEmMAtVevaP0 zcepVBPcoRY4B0kAi8VqEx+l0/fSYjo= X-Received: by 2002:ac2:5310:: with SMTP id c16mr3599169lfh.102.1576716705149; Wed, 18 Dec 2019 16:51:45 -0800 (PST) Received: from mail-lj1-f175.google.com (mail-lj1-f175.google.com. [209.85.208.175]) by smtp.gmail.com with ESMTPSA id i2sm1819642lfl.20.2019.12.18.16.51.43 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 18 Dec 2019 16:51:44 -0800 (PST) Received: by mail-lj1-f175.google.com with SMTP id p8so4261420ljg.0 for ; Wed, 18 Dec 2019 16:51:43 -0800 (PST) X-Received: by 2002:a2e:91cb:: with SMTP id u11mr3975797ljg.82.1576716703501; Wed, 18 Dec 2019 16:51:43 -0800 (PST) MIME-Version: 1.0 References: <157558502272.10278.8718685637610645781.stgit@warthog.procyon.org.uk> <20191206135604.GB2734@twin.jikos.cz> <20191219000013.GB13065@localhost> <20191219001446.GA49812@localhost> In-Reply-To: <20191219001446.GA49812@localhost> From: Linus Torvalds Date: Wed, 18 Dec 2019 16:51:27 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 0/2] pipe: Fixes [ver #2] To: Josh Triplett Cc: Konstantin Khlebnikov , Akemi Yagi , DJ Delorie , David Sterba , David Howells , Eric Biggers , Al Viro , linux-fsdevel , Linux Kernel Mailing List , Peter Zijlstra , Ingo Molnar , Vincent Guittot 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 On Wed, Dec 18, 2019 at 4:14 PM Josh Triplett wrote: > > Er, wrong file. That's the original patch; the attached patch is the > right one. This looks correct to me. If I were to actually commit it, the "split into two waitqueues" would be a separate patch from the "use wait_event_interruptible_exclusive() and add "wake_next_reader/writer logic", but for testing purposes the unified patch was simpler, and your forward port looks good to me. I ran the original patch for a couple of days, and didn't see any other issues than the 'make' thing in F30. It was all good with my self-build make. But that "ran for a couple of days" wasn't all that stress-full. I did do the "verify that the thundering herd is gone" test - including that silly test-case here again: #include int main(int argc, char **argv) { int fd[2], counters[2]; pipe(fd); counters[0] = 0; counters[1] = -1; write(fd[1], counters, sizeof(counters)); /* 64 processes */ fork(); fork(); fork(); fork(); fork(); fork(); do { int i; read(fd[0], &i, sizeof(i)); if (i < 0) continue; counters[0] = i+1; write(fd[1], counters, (1+(i & 1)) *sizeof(int)); } while (counters[0] < 1000000); return 0; } where you can tweak the numbers - add another fork() or two to create even more pipe waiters, and maybe change the final count exit value to match whatever hw performance you have. Linus