From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 51AC4C433EF for ; Sun, 13 Mar 2022 02:37:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233420AbiCMCi5 (ORCPT ); Sat, 12 Mar 2022 21:38:57 -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 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.