Message ID | 20230301160315.1022488-1-aleksander.lobakin@intel.com |
---|---|
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp3715435wrd; Wed, 1 Mar 2023 08:05:37 -0800 (PST) X-Google-Smtp-Source: AK7set+fBG5bxSPM64zSki9edO2zNKqOzNIG08nb/0AnEAuvNp+xWi1gLkFFg8mmfkH/uUA6Xs1s X-Received: by 2002:a05:6402:8d8:b0:4bc:ab52:ac70 with SMTP id d24-20020a05640208d800b004bcab52ac70mr1888267edz.8.1677686737610; Wed, 01 Mar 2023 08:05:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677686737; cv=none; d=google.com; s=arc-20160816; b=KW4cO13J/nHgQZZHQwuAALQ9FzmxiDKUM0I7IAwqrCDNUj/vDuuYx5duQTxgocGvqp KOwGMmMTHdrhg0MlgGhAVgfHO7mrKpCo5VkQcYzH1smdJqXnWlwZ0GIGvNPOxLLf38uL 6/gHb9XXFZQK8JYbDugfvMHC5SdqDbeuP66eReCXsyUtcUgI8CXxNOOUUDw/rViJ174x sZoPe4hh5zTQe55lmhiP8qH5vM4z6GVK1FtPaYcUsobCxjrx483C1zQ0C2cMwc/FWL39 Jko3RRXwJGsjPpJnybMFbBI0Pr4HmtejZmOmOTvazRmcmt/s+YemCkzq6dKOMQBMS/Br xE3A== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=5v+0yLhKw5F2TvYQWuBWz/sFyXP1fP4qkm6mjnJH89U=; b=MFLf7WS0nSNmMUwHcvQxBKv2BtfqaImBsou1HzoQQD7MPaEq6ZX3nF+pxbIKt/huU7 0V07i9I4buZm0Fi+pw9r6CKmFvDz2PNN9zF429/pBN0ws8BHRsSNIP2x7hRSqOxCtVHI Tntub+tvIsmojNoiekyAurjs/eUnGTKTnwsE9RJuCT1ylXGTmkXRMF5ytpGwnW0ER7pH zfh/iMII0JB4XdxnQ7rrXfDiTgD10Sa5A8BSKpy/45GsyylEF8IV0rzqgQChwHoXvTvE Ap7nqoiY+Chl53vTb4ZkOzcD1GdfhJn358NMcD5m2lA+NEYZdrTmDcx7/HBQO7WMqMS3 muXA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=GiMg34Y1; 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=intel.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y4-20020a056402134400b004ad7c4bc8b5si239048edw.261.2023.03.01.08.05.11; Wed, 01 Mar 2023 08:05:37 -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=@intel.com header.s=Intel header.b=GiMg34Y1; 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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229668AbjCAQET (ORCPT <rfc822;david.simonyants@gmail.com> + 99 others); Wed, 1 Mar 2023 11:04:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54660 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229518AbjCAQER (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 1 Mar 2023 11:04:17 -0500 Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A5C0C39CDF; Wed, 1 Mar 2023 08:04:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1677686656; x=1709222656; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=d/AlPNIfFJMeuNDvXYvovJqMQt5mLfiIJ+uNtGjrJRI=; b=GiMg34Y1uahXUqUzlBInkSNneJek05VlWGLI0SNr83jxm1TSkzHoLWdQ tWC7+r54hDl9Dx0zIbc+EQT3nK9Bgr3xwJG78ewNYuDJadLLGixaJQDQn EqbwL/kkU4QvEE6xly3nNBptQz8DDjNjWq7wZnSkl7xz1jjP3RX2hH4Tn LiPFFM0If8W86ctO+IRp2r5zoIWO9rO8u1NBgjs7y0N9EFBF38CSHo+cR 4RqRRIYOC5WpLqdamgT75Z8ndwpFomxPQImZy4bIMy42oD1i3M8AFVUzR 0l1+hRkNRYieu3AFQw9zGmj7UShB0A5zJbC5B06Ik26Tt1nENzLl2qvi6 Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10636"; a="322709877" X-IronPort-AV: E=Sophos;i="5.98,225,1673942400"; d="scan'208";a="322709877" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Mar 2023 08:04:15 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10636"; a="848686054" X-IronPort-AV: E=Sophos;i="5.98,225,1673942400"; d="scan'208";a="848686054" Received: from irvmail002.ir.intel.com ([10.43.11.120]) by orsmga005.jf.intel.com with ESMTP; 01 Mar 2023 08:04:12 -0800 Received: from newjersey.igk.intel.com (newjersey.igk.intel.com [10.102.20.203]) by irvmail002.ir.intel.com (Postfix) with ESMTP id 34C1336C07; Wed, 1 Mar 2023 16:04:11 +0000 (GMT) From: Alexander Lobakin <aleksander.lobakin@intel.com> To: Alexei Starovoitov <ast@kernel.org>, Daniel Borkmann <daniel@iogearbox.net>, Andrii Nakryiko <andrii@kernel.org>, Martin KaFai Lau <martin.lau@linux.dev> Cc: Alexander Lobakin <aleksander.lobakin@intel.com>, Maciej Fijalkowski <maciej.fijalkowski@intel.com>, Larysa Zaremba <larysa.zaremba@intel.com>, =?utf-8?q?Toke_H=C3=B8iland-J?= =?utf-8?q?=C3=B8rgensen?= <toke@redhat.com>, Song Liu <song@kernel.org>, Jesper Dangaard Brouer <hawk@kernel.org>, Jakub Kicinski <kuba@kernel.org>, bpf@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH bpf-next v1 0/2] xdp: recycle Page Pool backed skbs built from XDP frames Date: Wed, 1 Mar 2023 17:03:13 +0100 Message-Id: <20230301160315.1022488-1-aleksander.lobakin@intel.com> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759182048609422746?= X-GMAIL-MSGID: =?utf-8?q?1759182048609422746?= |
Series |
xdp: recycle Page Pool backed skbs built from XDP frames
|
|
Message
Alexander Lobakin
March 1, 2023, 4:03 p.m. UTC
Yeah, I still remember that "Who needs cpumap nowadays" (c), but anyway. __xdp_build_skb_from_frame() missed the moment when the networking stack became able to recycle skb pages backed by a Page Pool. This was making e.g. cpumap redirect even less effective than simple %XDP_PASS. veth was also affected in some scenarios. A lot of drivers use skb_mark_for_recycle() already, it's been almost two years and seems like there are no issues in using it in the generic code too. {__,}xdp_release_frame() can be then removed as it losts its last user. Page Pool becomes then zero-alloc (or almost) in the abovementioned cases, too. Other memory type models (who needs them at this point) have no changes. Some numbers on 1 Xeon Platinum core bombed with 27 Mpps of 64-byte IPv6 UDP: Plain %XDP_PASS on baseline, Page Pool driver: src cpu Rx drops dst cpu Rx 2.1 Mpps N/A 2.1 Mpps cpumap redirect (w/o leaving its node) on baseline: 6.8 Mpps 5.0 Mpps 1.8 Mpps cpumap redirect with skb PP recycling: 7.9 Mpps 5.7 Mpps 2.2 Mpps +22% Alexander Lobakin (2): xdp: recycle Page Pool backed skbs built from XDP frames xdp: remove unused {__,}xdp_release_frame() include/net/xdp.h | 29 ----------------------------- net/core/xdp.c | 19 ++----------------- 2 files changed, 2 insertions(+), 46 deletions(-)
Comments
On 01/03/2023 17.03, Alexander Lobakin wrote: > Yeah, I still remember that "Who needs cpumap nowadays" (c), but anyway. > > __xdp_build_skb_from_frame() missed the moment when the networking stack > became able to recycle skb pages backed by a Page Pool. This was making ^^^^^^^^^ When talking about page_pool, can we write "page_pool" instead of capitalized "Page Pool", please. I looked through the git log, and here we all used "page_pool". > e.g. cpumap redirect even less effective than simple %XDP_PASS. veth was > also affected in some scenarios. Thanks for working on closing this gap :-) > A lot of drivers use skb_mark_for_recycle() already, it's been almost > two years and seems like there are no issues in using it in the generic > code too. {__,}xdp_release_frame() can be then removed as it losts its > last user. > Page Pool becomes then zero-alloc (or almost) in the abovementioned > cases, too. Other memory type models (who needs them at this point) > have no changes. > > Some numbers on 1 Xeon Platinum core bombed with 27 Mpps of 64-byte > IPv6 UDP: What NIC driver? > > Plain %XDP_PASS on baseline, Page Pool driver: > > src cpu Rx drops dst cpu Rx > 2.1 Mpps N/A 2.1 Mpps > > cpumap redirect (w/o leaving its node) on baseline: > > 6.8 Mpps 5.0 Mpps 1.8 Mpps > > cpumap redirect with skb PP recycling: > > 7.9 Mpps 5.7 Mpps 2.2 Mpps +22% > It is of cause awesome, that cpumap SKBs are faster than normal SKB path. I do wonder where the +22% number comes from? > Alexander Lobakin (2): > xdp: recycle Page Pool backed skbs built from XDP frames > xdp: remove unused {__,}xdp_release_frame() > > include/net/xdp.h | 29 ----------------------------- > net/core/xdp.c | 19 ++----------------- > 2 files changed, 2 insertions(+), 46 deletions(-) >
From: Jesper Dangaard Brouer <jbrouer@redhat.com> Date: Fri, 3 Mar 2023 11:39:06 +0100 > > On 01/03/2023 17.03, Alexander Lobakin wrote: >> Yeah, I still remember that "Who needs cpumap nowadays" (c), but anyway. >> >> __xdp_build_skb_from_frame() missed the moment when the networking stack >> became able to recycle skb pages backed by a Page Pool. This was making > ^^^^^^^^^ > When talking about page_pool, can we write "page_pool" instead of > capitalized "Page Pool", please. I looked through the git log, and here > we all used "page_pool". Ah okay, no prob :D Yeah, that's probably more correct. "Page Pool" is the name of the API, while page_pool is an entity we create via page_pool_create(). > >> e.g. cpumap redirect even less effective than simple %XDP_PASS. veth was >> also affected in some scenarios. > > Thanks for working on closing this gap :-) > >> A lot of drivers use skb_mark_for_recycle() already, it's been almost >> two years and seems like there are no issues in using it in the generic >> code too. {__,}xdp_release_frame() can be then removed as it losts its >> last user. >> Page Pool becomes then zero-alloc (or almost) in the abovementioned >> cases, too. Other memory type models (who needs them at this point) >> have no changes. >> >> Some numbers on 1 Xeon Platinum core bombed with 27 Mpps of 64-byte >> IPv6 UDP: > > What NIC driver? IAVF with XDP, the series adding XDP support will be sent in a couple weeks, WIP can be found on my open GH[0]. > >> >> Plain %XDP_PASS on baseline, Page Pool driver: >> >> src cpu Rx drops dst cpu Rx >> 2.1 Mpps N/A 2.1 Mpps >> >> cpumap redirect (w/o leaving its node) on baseline: >> >> 6.8 Mpps 5.0 Mpps 1.8 Mpps >> >> cpumap redirect with skb PP recycling: >> >> 7.9 Mpps 5.7 Mpps 2.2 Mpps +22% >> > > It is of cause awesome, that cpumap SKBs are faster than normal SKB path. That's the point of cpumap redirect, right? You separate NAPI poll / IRQ handling from the skb networking stack traveling to a different CPU, including page freeing (or recycling). That takes a lot of load from the source CPU. 0.1 Mpps is not the highest difference I got, cpumap redirect can boost up to 0.5 Mpps IIRC. > I do wonder where the +22% number comes from? (2.2 - 1.8) / 1.8 * 100%. I compare baseline cpumap redirect before/after here :) > >> Alexander Lobakin (2): >> xdp: recycle Page Pool backed skbs built from XDP frames >> xdp: remove unused {__,}xdp_release_frame() >> >> include/net/xdp.h | 29 ----------------------------- >> net/core/xdp.c | 19 ++----------------- >> 2 files changed, 2 insertions(+), 46 deletions(-) >> > There's a build failure on non-PP systems due to skb_mark_for_recycle() being declared only when CONFIG_PAGE_POOL is set. I'll spin v2 in a bit. [0] https://github.com/alobakin/linux/commits/iavf-xdp Thanks, Olek