Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp6225456rwp; Mon, 17 Jul 2023 17:58:13 -0700 (PDT) X-Google-Smtp-Source: APBJJlH3nSJ8Y7WyiFHqoyjKQu/1JcUkb03RZFz2kR3/PQokFrPQ3KOCeLgf3duPzUKzYK62Yg24 X-Received: by 2002:a17:907:98af:b0:98d:f4a7:71cf with SMTP id ju15-20020a17090798af00b0098df4a771cfmr11338800ejc.62.1689641892874; Mon, 17 Jul 2023 17:58:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689641892; cv=none; d=google.com; s=arc-20160816; b=nLJujjXF4pktPIUC9IZJImfNJjAwW8sxMqRlqaHLMV3ybvPweCugY923WGhCBOgmvK jA16aZDhW+Wfa+hnMw2Dze7IDrAHvOdSOf+A/7h5Ne0VDu2pPNSmKhM0fVI4C4r9vwSn /ToJkbG/j5HyBXx4K/s8ePZBp9g3iU4jEx4qVvuOtXfYa1vqGER/bP172JFCqPhXT0Ba U7K23a2/WHdpSfTJIe5lhPErZ3nP2WrQghPbsOWV5P4QmN59soMsuYH10cDmDBYlMl7g bIOOZ97ocHw9L0KDFgv3URkmp9ks7vPPtDDsjmOM2pq39fojq8T3KeQCciRm+zjmZHH/ iP2A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:subject:mime-version:date:dkim-signature :message-id; bh=bhW9hWOzuPO3ascL2TqqhoQF4927LJi53dnYLFnBGSs=; fh=e//qb72TR8y5QJ67dRAiDIGkJwKJwwznFuXnyUjIwPs=; b=YS7vKq+8LOh+F2Udct2hFP4RQUeBGc9ySp3NMu7s2KWF7BVU0AsYyWsZVgDPRxjdlV 4AtSkyQfN5UH8WQFfwwaKmMiHeIng+MZx0DKZJ0jgPjWzA/sLsIn6LBiZTu1b3IgnrAK UNZ1f8Gw3+hyEN69RVkh+Dkvc45b8hf5V4nqzgDrXzz+RwmeuwrUqj3yt5xvmWZ6aVQK 0wIlm8gZxASoyOKCuaBe12fOhvURvj87pRGBYmcbqu856CqXoGeRbywcFaCl8284GeM/ X51j/lsS6dsPRWgE/0XqIwxkTkYlUvd9lpgBBXcdjBMHr2hfy5ssFW9TDE9z0izwQSdc 6PGQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=SkzjRAxh; 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=linux.dev Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u11-20020a1709060b0b00b0098d373fa9d9si421808ejg.149.2023.07.17.17.57.49; Mon, 17 Jul 2023 17:58:12 -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=@linux.dev header.s=key1 header.b=SkzjRAxh; 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=linux.dev Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229774AbjGRAAH (ORCPT + 99 others); Mon, 17 Jul 2023 20:00:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35094 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229514AbjGRAAG (ORCPT ); Mon, 17 Jul 2023 20:00:06 -0400 Received: from out-56.mta0.migadu.com (out-56.mta0.migadu.com [91.218.175.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E574CF0 for ; Mon, 17 Jul 2023 17:00:01 -0700 (PDT) Message-ID: <062768e0-90d6-33dc-162a-c4adaa612f67@linux.dev> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1689638399; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=bhW9hWOzuPO3ascL2TqqhoQF4927LJi53dnYLFnBGSs=; b=SkzjRAxh0UkLbY0uBKTCS5sP9FXnWZKGihuXHKPOF1ffAqOWKdCsk6+ZpM+MVCPSmnPWo5 Eyq9IItyWV8dpK/3lig2h85063nUWXxGqyieU99J9i6e67JcYKpJ4MAy7OdtVIor0iorQO JvxkaW6Bb575fVSKPCEETcayyHZlgF8= Date: Tue, 18 Jul 2023 07:59:47 +0800 MIME-Version: 1.0 Subject: Re: RE: [PATCH net-next] net: mana: Add page pool for RX buffers To: Haiyang Zhang , Jesper Dangaard Brouer , Jakub Kicinski Cc: "brouer@redhat.com" , "linux-hyperv@vger.kernel.org" , "netdev@vger.kernel.org" , Dexuan Cui , KY Srinivasan , Paul Rosswurm , "olaf@aepfle.de" , "vkuznets@redhat.com" , "davem@davemloft.net" , "wei.liu@kernel.org" , "edumazet@google.com" , "pabeni@redhat.com" , "leon@kernel.org" , Long Li , "ssengar@linux.microsoft.com" , "linux-rdma@vger.kernel.org" , "daniel@iogearbox.net" , "john.fastabend@gmail.com" , "bpf@vger.kernel.org" , "ast@kernel.org" , Ajay Sharma , "hawk@kernel.org" , "tglx@linutronix.de" , "shradhagupta@linux.microsoft.com" , "linux-kernel@vger.kernel.org" , Ilias Apalodimas References: <1689259687-5231-1-git-send-email-haiyangz@microsoft.com> <20230713205326.5f960907@kernel.org> <85bfa818-6856-e3ea-ef4d-16646c57d1cc@redhat.com> X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Zhu Yanjun In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 在 2023/7/14 20:51, Haiyang Zhang 写道: > > >> -----Original Message----- >> From: Jesper Dangaard Brouer >> On 14/07/2023 05.53, Jakub Kicinski wrote: >>> On Thu, 13 Jul 2023 14:48:45 +0000 Haiyang Zhang wrote: >>>> Add page pool for RX buffers for faster buffer cycle and reduce CPU >>>> usage. >>>> >>>> Get an extra ref count of a page after allocation, so after upper >>>> layers put the page, it's still referenced by the pool. We can reuse >>>> it as RX buffer without alloc a new page. >>> >>> Please use the real page_pool API from include/net/page_pool.h >>> We've moved past every driver reinventing the wheel, sorry. >> >> +1 >> >> Quoting[1]: Documentation/networking/page_pool.rst >> >> Basic use involves replacing alloc_pages() calls with the >> page_pool_alloc_pages() call. >> Drivers should use page_pool_dev_alloc_pages() replacing >> dev_alloc_pages(). > > Thank Jakub and Jesper for the reviews. > I'm aware of the page_pool.rst doc, and actually tried it before this > patch, but I got lower perf. If I understand correctly, we should call > page_pool_release_page() before passing the SKB to napi_gro_receive(). > If I get this commit correctly, this commit is to use page pool to get better performance. IIRC, folio is to make memory optimization. From the performance results, with folio, the performance will get about 10%. So not sure if the folio can be used in this commit to get better performance. That is my 2 cent. Zhu Yanjun > I found the page_pool_dev_alloc_pages() goes through the slow path, > because the page_pool_release_page() let the page leave the pool. > > Do we have to call page_pool_release_page() before passing the SKB > to napi_gro_receive()? Any better way to recycle the pages from the > upper layer of non-XDP case? > > Thanks, > - Haiyang >