Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp415432rwd; Wed, 17 May 2023 21:24:18 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6CBBiadGprLqHvrrzvhxEKFUpLYDPFfZgfzSEY3vKn1Jh7U0QU8l788+1zBheuFTENCskA X-Received: by 2002:a05:6a20:4323:b0:104:a053:12fb with SMTP id h35-20020a056a20432300b00104a05312fbmr781356pzk.60.1684383858090; Wed, 17 May 2023 21:24:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684383858; cv=none; d=google.com; s=arc-20160816; b=si2MZ+0/+Cw5xTEkVa02sQ2q6cV6OGDCiCLRBbKFUECsR6jXRaY/wLrVwmE0vB4y52 WZtbR1EcGwJQKP8sho+Uqfg1Go5dcniDgUOaCioFwQf8w5MyukOAPFrihGJY8bOEdneK yQvJaMtH4DHrgwBvNzlhTov8v3gJUq/gwyZoAq2B4tqXKwhQdDPCWQM6K7gN/e5SFakV cWQvRGmOmYEDuVHo2LkiN5ZqRqcN0ZBWBr0Ch1gvmZ+lY1/cx5thETq4CCCkXPFYEgTp VQFc72m8cIamohWusyX4UTQp4AQNzWE6exlKmtrCot9NQ4Qf/1sjhtM4/JaF+7Tkt9gT rFLw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=vqDKTK9ld3tUon+RnCGDCEyJHPbAokEGHvHDoeCB0oY=; b=NN0G2rPINFkols3lPpjB66CNIZDZkpJh7olgaCP/wxttq//PaHYwnEG0UaS9MnS0x6 GQ7KrtPBQir/a3d2UXv3Nw4CBDWXjkbMtGnoTaKWOHlYm2Wp5/Gm4DcaxFQPXeFH2gQb 4uiAdtHEFXPQFhVMyk1CQtExfuo9brFxv9v5i9p7x4aF9P4QOZht2hQan4xXFccDyT1X 3foHm/G300Gye8zRktlK4U/SFteu48Vit6YNFLCr8VRY31eu2nfjnsMo/Ln5NTzFCLHx psNQUcxDEQPjTlz6wGHg0YH2L9OOZ5/c9mQOvNz21BTIMKjJPxClp1CzhaWILcsBaYJw YPcg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=fVrI0irR; 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=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 195-20020a6302cc000000b00534253c0576si473004pgc.535.2023.05.17.21.24.05; Wed, 17 May 2023 21:24:18 -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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=fVrI0irR; 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=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229981AbjEREI0 (ORCPT + 99 others); Thu, 18 May 2023 00:08:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60350 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229991AbjEREIJ (ORCPT ); Thu, 18 May 2023 00:08:09 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 579A235A9 for ; Wed, 17 May 2023 21:08:07 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E76BD64CDD for ; Thu, 18 May 2023 04:08:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B6DAFC433EF; Thu, 18 May 2023 04:08:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1684382886; bh=ADz8kxD3Luyc/5/5hhVRSVuuJbhH+25ni9y4rvosUjo=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=fVrI0irRX5VsTxRAKOoWx+H3FkBZ4ItcOevDWVNX+Sykq22FT8OQzNyzomFxA9+98 tR5zFpOhvHTLs2w+xiHklppIvqhxKmavy0kipowd/fsGbQyR3G6+k8306KWzrrWCg9 pRO7C0Ht/9AHEmuouBckI4umXvClVr8IsH+b1OEJyT3maHzaQiCEcphaS1it/cVQkj n10hKZ43zivv43EX06PqmToFieGnOxFDR4vDtSGWRhQZdYYpAHLB9UL1rtu7vQUlzz I64wOU4/Ivoz5CEw8cxBrs7MLzO/OwdE3mIXWTNilX1xqIbndGLr27mxGMf74f7vTo TqEU9TYgtDUqg== Date: Wed, 17 May 2023 21:08:04 -0700 From: Jakub Kicinski To: Alexander Lobakin Cc: "David S. Miller" , Eric Dumazet , Paolo Abeni , Maciej Fijalkowski , Magnus Karlsson , Michal Kubiak , Larysa Zaremba , Jesper Dangaard Brouer , Ilias Apalodimas , Christoph Hellwig , netdev@vger.kernel.org, intel-wired-lan@lists.osuosl.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH net-next 06/11] net: page_pool: avoid calling no-op externals when possible Message-ID: <20230517210804.7de610bd@kernel.org> In-Reply-To: <20230516161841.37138-7-aleksander.lobakin@intel.com> References: <20230516161841.37138-1-aleksander.lobakin@intel.com> <20230516161841.37138-7-aleksander.lobakin@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,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 Tue, 16 May 2023 18:18:36 +0200 Alexander Lobakin wrote: > + /* Try to avoid calling no-op syncs */ > + pool->p.flags |= PP_FLAG_DMA_MAYBE_SYNC; > + pool->p.flags &= ~PP_FLAG_DMA_SYNC_DEV; > } > > if (PAGE_POOL_DMA_USE_PP_FRAG_COUNT && > @@ -323,6 +327,12 @@ static bool page_pool_dma_map(struct page_pool *pool, struct page *page) > > page_pool_set_dma_addr(page, dma); > > + if ((pool->p.flags & PP_FLAG_DMA_MAYBE_SYNC) && > + dma_need_sync(pool->p.dev, dma)) { > + pool->p.flags |= PP_FLAG_DMA_SYNC_DEV; > + pool->p.flags &= ~PP_FLAG_DMA_MAYBE_SYNC; > + } is it just me or does it feel cleaner to allocate a page at init, and throw it into the cache, rather than adding a condition to a fast(ish) path?