Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp1792063rwb; Tue, 29 Nov 2022 20:00:14 -0800 (PST) X-Google-Smtp-Source: AA0mqf51DO5/KAW56P46MpRlrcCMnFAu+8s7ea1sEERXwzi0pCua196Bj9iRRj1xdVUBwTktzYn7 X-Received: by 2002:a05:6402:396:b0:46b:9c63:fa87 with SMTP id o22-20020a056402039600b0046b9c63fa87mr3270669edv.100.1669780814217; Tue, 29 Nov 2022 20:00:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669780814; cv=none; d=google.com; s=arc-20160816; b=OEbrKNp03/WBKylqArzgm4CY/Ki5BZZs7yhhZlqbp8BpTeP+6sH8q4FyQ18izM0hiS BUB/mAYIn4SWPkwUFA8ANAXgyX1WH5hXcvAg6Nl37Kf3fnUHFApMllc0TQG++cspfbl7 wHbfqLaqAAYnHUF9JZR6ftLRuMVcajPyimHGDCs6VkiC02sCwScUf5gQtZ0LqL5uSEag OLYkreoxvRBsljjniD7IsAgHyh/377pmMxipnz5ZOLLbF/jdV/Krm7bhaveoTe3KjPWO /5XAeMMaRul0fxHheKaEH54+BV+mScd4tTKpmCZGIpRWZRgXgF6Zzh3tUyRY9ffo9v0b XlwQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=xoKwaxsoBTuq6caiMH51+e7OBBLm1ZQwP+caQE5Hz20=; b=ArWs8KKg4oys8QOPALvKCl3FKuRzRi47NpMCaWBv4vH8qsEMLO+ocWZ+3Hss9gzJpR 33vvzBijNuQiozrbmA6Y0A3ASEhvZoE/A3YOg5uXFkcw/pyjsWMy7gzZdeMtZn8knlNJ D+hzl17wmeUi9pgbNdk5SNAXvjYi+FoPjT+TQ5vxVuLhoeh3AVGpUZzEkpaHkKzgKyRG RdlcWvGjbRlvLusf8M6OUCS6ISWvQNHpjFNhkjDs/1NfvGkFAN93ux72zt3sJfBM+Ub6 N7HPvM2y/jKRJqB325pPZgvPw9lB5oSvIrgTuujpzZMyK4Fn31yzFaUzvDtoejc0JP58 /z1w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=MzAwN7oB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ck5-20020a170906c44500b0078c8dadd4bbsi264487ejb.742.2022.11.29.19.59.52; Tue, 29 Nov 2022 20:00:14 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=MzAwN7oB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232568AbiK3DlO (ORCPT + 85 others); Tue, 29 Nov 2022 22:41:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56334 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231757AbiK3DlF (ORCPT ); Tue, 29 Nov 2022 22:41:05 -0500 Received: from mail-qv1-xf36.google.com (mail-qv1-xf36.google.com [IPv6:2607:f8b0:4864:20::f36]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0CB0C70DE7; Tue, 29 Nov 2022 19:41:05 -0800 (PST) Received: by mail-qv1-xf36.google.com with SMTP id h10so11155801qvq.7; Tue, 29 Nov 2022 19:41:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=xoKwaxsoBTuq6caiMH51+e7OBBLm1ZQwP+caQE5Hz20=; b=MzAwN7oBWwvha7Zlwgs6liSVdb1KbBAyeKIDEaNZaOdDjbIgac4GcW5KTBGkjpQE3f pYo3whXLEgbbB47IomRI1kyqGdJ9zlDAzon5JQ2R3ZUAhcxgEHcp0ghwbPSV0BD1Nu+P Wb4c+WZi/9GaflpFa3xEeRR7nkwH7Z4NurCHByL55Ld/F/iOOJna/4u1D3OKhJf3hEsf zPlUcoIfCU937f9VtpNjbGzxVzwt7OzPi++BHenfPBrqLpgXr2F7mvZXM91ruNVE+mls rucFXZNSYawLiBUujtS+6CuSH0wvrCxLWhoU23zk/yLBxXTMJ4PbdY5eB1PjoqYtlD9B wQkA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=xoKwaxsoBTuq6caiMH51+e7OBBLm1ZQwP+caQE5Hz20=; b=TKuZJs20wfaF3o7kiAmVVubvBll2bq5TWrQ5XzXih9dIv4aEoJsVGMmDC3OQiS8Xww cvQ8DWCSmCGQcaNhvRO+4ulW3siC0sa9vPo0wM7FT/cnMcOB21qpub1WqwXJoKinWW6w Zh4PoVZWbPdujOYaS/Huh18M97bRngm1zw1xMSlB23cBH86Ffv/7hzK0tZcuE99WZzWE gpx+3tjTrbkVOEQD2xGVr+5rLfBRQ0sFmqtcxqNVhc8t+vQuyDKNTZtAhQXqMGw7SY2w OBIoJFG2QI0FIC0o4bu085gzLk2S1JMoUnOOBVmwwNmemCumoQlbgUCaCZP1tPZ2i4ga PRXg== X-Gm-Message-State: ANoB5plhiL1AEHjIpeDEuxjwBaCksBqZRD+PiJ5jVPc9yEu44yB3+0k9 zMTZzvA5cIfwhjf8fwQDFLdDOxz7pg== X-Received: by 2002:ad4:5291:0:b0:4c6:e1ba:b1c with SMTP id v17-20020ad45291000000b004c6e1ba0b1cmr25609989qvr.73.1669779664172; Tue, 29 Nov 2022 19:41:04 -0800 (PST) Received: from bytedance ([130.44.212.155]) by smtp.gmail.com with ESMTPSA id do33-20020a05620a2b2100b006cdd0939ffbsm209018qkb.86.2022.11.29.19.41.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Nov 2022 19:41:03 -0800 (PST) Date: Tue, 29 Nov 2022 19:40:59 -0800 From: Peilin Ye To: Al Viro Cc: Peilin Ye , Cong Wang , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] coredump: Use vmsplice_to_pipe() for pipes in dump_emit_page() Message-ID: <20221130034059.GA2246@bytedance> References: <20221029005147.2553-1-yepeilin.cs@gmail.com> <20221031210349.3346-1-yepeilin.cs@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Nov 19, 2022 at 04:46:17AM +0000, Al Viro wrote: > On Mon, Oct 31, 2022 at 02:03:49PM -0700, Peilin Ye wrote: > > > + n = vmsplice_to_pipe(file, &iter, 0); > > + if (n == -EBADF) > > + n = __kernel_write_iter(cprm->file, &iter, &pos); > > Yuck. If anything, I would rather put a flag into coredump_params > and check it instead; this check for -EBADF is both unidiomatic and > brittle. Suppose someday somebody looks at vmsplice(2) and > decides that it would make sense to lift the "is it a pipe" check > into e.g. vmsplice_type(). There's no obvious reasons not to, > unless one happens to know that coredump relies upon that check done > in vmsplice_to_pipe(). It's asking for trouble several years down > the road. > > Make it explicit and independent from details of error checking > in vmsplice(2). Thanks for the review! I was a bit hesitant about introducing a new field to coredump_params for this optimization. Will do it in v3. Peilin Ye