From patchwork Wed Dec 21 18:56:11 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Schwab X-Patchwork-Id: 9483675 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 7B597601D2 for ; Wed, 21 Dec 2016 18:56:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6C92B283F7 for ; Wed, 21 Dec 2016 18:56:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6036C28424; Wed, 21 Dec 2016 18:56:25 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 27E6F283F7 for ; Wed, 21 Dec 2016 18:56:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754164AbcLUS4W (ORCPT ); Wed, 21 Dec 2016 13:56:22 -0500 Received: from mail-out.m-online.net ([212.18.0.9]:45636 "EHLO mail-out.m-online.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750919AbcLUS4V (ORCPT ); Wed, 21 Dec 2016 13:56:21 -0500 Received: from frontend01.mail.m-online.net (unknown [192.168.8.182]) by mail-out.m-online.net (Postfix) with ESMTP id 3tkP4s6DMVz3hjMG; Wed, 21 Dec 2016 19:56:13 +0100 (CET) Received: from localhost (dynscan1.mnet-online.de [192.168.6.68]) by mail.m-online.net (Postfix) with ESMTP id 3tkP4s51mPzvh2c; Wed, 21 Dec 2016 19:56:13 +0100 (CET) X-Virus-Scanned: amavisd-new at mnet-online.de Received: from mail.mnet-online.de ([192.168.8.182]) by localhost (dynscan1.mail.m-online.net [192.168.6.68]) (amavisd-new, port 10024) with ESMTP id sfa8GrjYE7Ik; Wed, 21 Dec 2016 19:56:12 +0100 (CET) X-Auth-Info: Z8lYR4CQxmW5PbPNG113HjE1u56zSVCo8q5JxdanXvoPIbjr1WOo/XKCZKipEFxz Received: from igel.home (ppp-88-217-9-208.dynamic.mnet-online.de [88.217.9.208]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by mail.mnet-online.de (Postfix) with ESMTPSA; Wed, 21 Dec 2016 19:56:12 +0100 (CET) Received: by igel.home (Postfix, from userid 1000) id 91F4C2C4A29; Wed, 21 Dec 2016 19:56:11 +0100 (CET) From: Andreas Schwab To: Linus Torvalds Cc: Al Viro , Dave Chinner , CAI Qian , linux-xfs , xfs@oss.sgi.com, Jens Axboe , Nick Piggin , linux-fsdevel Subject: Re: [PATCH 04/12] splice: lift pipe_lock out of splice_to_pipe() References: <20160917190023.GA8039@ZenIV.linux.org.uk> <20160923190032.GA25771@ZenIV.linux.org.uk> <20160923190326.GB2356@ZenIV.linux.org.uk> <20160923201025.GJ2356@ZenIV.linux.org.uk> <20160924035951.GN2356@ZenIV.linux.org.uk> <87shpmxrey.fsf@linux-m68k.org> <20161218201207.GY1555@ZenIV.linux.org.uk> <20161218203003.GZ1555@ZenIV.linux.org.uk> X-Yow: Pardon me, but do you know what it means to be TRULY ONE with your BOOTH! Date: Wed, 21 Dec 2016 19:56:11 +0100 In-Reply-To: (Linus Torvalds's message of "Sun, 18 Dec 2016 14:10:54 -0800") Message-ID: <87shphaz78.fsf@linux-m68k.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.90 (gnu/linux) MIME-Version: 1.0 Sender: linux-xfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On Dez 18 2016, Linus Torvalds wrote: > Regardless - Andreas, can you verify that that fixes your issues? I'm > assuming you had some real load that made you notice this, not just he > dummy example.. FWIW, I have verified that the testsuite of pv succeeds with this patch: diff --git a/fs/splice.c b/fs/splice.c index 5a7750bd2e..63b8f54485 100644 --- a/fs/splice.c +++ b/fs/splice.c @@ -1086,7 +1086,13 @@ EXPORT_SYMBOL(do_splice_direct); static int wait_for_space(struct pipe_inode_info *pipe, unsigned flags) { - while (pipe->nrbufs == pipe->buffers) { + for (;;) { + if (unlikely(!pipe->readers)) { + send_sig(SIGPIPE, current, 0); + return -EPIPE; + } + if (pipe->nrbufs != pipe->buffers) + return 0; if (flags & SPLICE_F_NONBLOCK) return -EAGAIN; if (signal_pending(current)) @@ -1095,7 +1101,6 @@ static int wait_for_space(struct pipe_inode_info *pipe, unsigned flags) pipe_wait(pipe); pipe->waiting_writers--; } - return 0; } static int splice_pipe_to_pipe(struct pipe_inode_info *ipipe,