Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp2032460pxp; Sun, 13 Mar 2022 07:00:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz1E5BaFuMVyNKS3zp3Fg5eEMkAt8wKWEO9hjEq4idtUd+7YRNbKjH6Y9rZcLC9dpcfahmB X-Received: by 2002:a17:902:cf08:b0:151:9d28:f46f with SMTP id i8-20020a170902cf0800b001519d28f46fmr19178107plg.53.1647180043987; Sun, 13 Mar 2022 07:00:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647180043; cv=none; d=google.com; s=arc-20160816; b=L5sseg2DZ7Xc2CCHVNOLcnIQqojY+yY8SDxwXcU3B1cH5ooeKfdOUDibXk0V5Nr87H Nqieol1H5qAZsO16XvKmwSJUJiAYwiufaNCvv/Y36QHf2tkl8RYjeaM/EtKY+N4zn8X7 VcZ22x3s/yBA4rnkk9ZE9bC4wumqh5uXyKhbgP7UFZ9a08q/5PEeHjIMYGd73fgDoLSo O8cQVdKyIs4hlfBhN6ifYSscKlRdYwuDLcg6wQ2wELV2GKngFi3RR8DA8iW63Pl13RJD 17oICviBWFZpTnBXO3OhAY9ctZ1SNVuSxIATAKt+GyENPW1OT0/0B3bAN+0gnlJgppsq pmbw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=BMsvITDWsk02VwZrCduCGI3kCqu96b/D+ERZneRZ7d4=; b=Ueu/ZSzHGU0bJ9+2gI3fB/DL6OFzfId8ootlAITDYJgOwkKu0K6zUFZF52KMncCEw7 e4et0uDvvlr4hXbr/5wR7RqZSoqVLrp1h4LQc3A/rgOrOwbYqARlfZ2Qzh9qQxauExcN h2Er4UiiL5xLc3SrRTNWS64S2vtTZrCIPK+iFIwxFDhUw+DerzUEaZlV54tR+FadYktH FoGjRiVIRNTKw/p7mi8aXSfkOo1e+fd2vsoTdNXYW2epYHisiJoNCWjzcwN4C5jBL3vA s//iSmcnSMCYVww7PXla6MZ1rztkVvRSLnhb6gqD4KYvvkMn3tFnAxlk5vekCEOnh5ad 8HIw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z88-20020a17090a6d6100b001bd14e01fb2si12965719pjj.160.2022.03.13.07.00.23; Sun, 13 Mar 2022 07:00:43 -0700 (PDT) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233411AbiCMCiz (ORCPT + 99 others); Sat, 12 Mar 2022 21:38:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53298 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233385AbiCMCiw (ORCPT ); Sat, 12 Mar 2022 21:38:52 -0500 Received: from zeniv-ca.linux.org.uk (zeniv-ca.linux.org.uk [IPv6:2607:5300:60:148a::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4C74135278; Sat, 12 Mar 2022 18:37:45 -0800 (PST) Received: from viro by zeniv-ca.linux.org.uk with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1nTE75-00AVXc-Tm; Sun, 13 Mar 2022 02:37:43 +0000 Date: Sun, 13 Mar 2022 02:37:43 +0000 From: Al Viro To: Max Kellermann Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 4/4] pipe_fs_i.h: add pipe_buf_init() Message-ID: References: <20220225185431.2617232-1-max.kellermann@gmail.com> <20220225185431.2617232-4-max.kellermann@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220225185431.2617232-4-max.kellermann@gmail.com> Sender: Al Viro X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE 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 Fri, Feb 25, 2022 at 07:54:31PM +0100, Max Kellermann wrote: > /* Insert it into the buffer array */ > buf = &pipe->bufs[head & mask]; > - buf->page = page; > - buf->ops = &anon_pipe_buf_ops; > - buf->offset = 0; > - buf->len = 0; > - if (is_packetized(filp)) > - buf->flags = PIPE_BUF_FLAG_PACKET; > - else > - buf->flags = PIPE_BUF_FLAG_CAN_MERGE; > + pipe_buf_init(buf, page, 0, 0, > + &anon_pipe_buf_ops, > + is_packetized(filp) ? PIPE_BUF_FLAG_PACKET : PIPE_BUF_FLAG_CAN_MERGE); *cringe* FWIW, packetized case is very rare, so how about turning that into pipe_buf_init(buf, page, 0, 0, &anon_pipe_buf_ops, PIPE_BUF_FLAG_CAN_MERGE); if (unlikely(is_packetized(filp))) buf->flags = PIPE_BUF_FLAG_PACKET; Your pipe_buf_init() is inlined, so it shouldn't be worse from the optimizer POV - it should be able to start with calculating that value and then storing that, etc.