Received: by 2002:ab2:1149:0:b0:1f3:1f8c:d0c6 with SMTP id z9csp105772lqz; Fri, 29 Mar 2024 09:56:08 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWSewAUShSrPGKVB8vYNFavHQN/+33EBO04EmuowsxjoUhDCsZM6JfreImQ6pnuQbqcHKg3xej0VL6+02M8LcPEuRKUuj/9Ms2lLc/OxQ== X-Google-Smtp-Source: AGHT+IESi/0gWZw1Q8R9Q5t30DGXIphg5bWH8tCfbfzA4fkT0dXlbtO8eRYHPHW/HBLUZPz6iUJT X-Received: by 2002:a05:622a:13c6:b0:431:5e30:ccb with SMTP id p6-20020a05622a13c600b004315e300ccbmr3001829qtk.49.1711731368129; Fri, 29 Mar 2024 09:56:08 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711731368; cv=pass; d=google.com; s=arc-20160816; b=aSQ7vAqecHguPDAg7d+Uoil/M8//mIxBmSqbTNF6/x1Nr9xkEOSeCx+lpDpzYSVcKV Q1BZPo3F+k4KC7JLwCQJTEVs5W+/RMysYXlOWMynEdrjcOCLZAlueO5TZNJJifUsJnY3 VLlOovx7Uo6kGIMJ07HA7w9LzOzpmIw7W5KRossnqqf/hiNFyp/uFk638xORhibJ2wJE tJDhLeRH5QegABJ3sCBiFmJ7ojkl0Din9ymbNfvztDHqdx4aCRaoKDHBxx9RZq8bKXTy lhkLWK1JsQYzAwHw+dHS3eR9ErKRy8QeJcjtSf6qot92hRSrHq33xUpVsLYNhFl6YYB7 Prvg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=YtOpGyW8K8Z6pjDPpLxppbwRKEOy/8omXF2Y1XMFO/0=; fh=DHNhE9A71kJkNe+CdCMIum2JU5JlfHDpezE6yhWpJrw=; b=F23O2BJ2uuwk7dNwXB+E3OCkX7sMPzl9VgNr22z9YB8hnmPVmQs47hwqzCAcRgKfpn L0nokAUqOMuS0eMxBiPiLvxwPcobdaRFDbJ/zuNo3dbbgpkuzG/hjIIfn0fs7zVYXN4F QDQqC9u/BGXhxev5OwFeIJZvI9noygR0jmLn8lekCIV6Cv/z36IZc5Jxn8XZv5+ezvsV 1oNm1xRyujxPQL++/rEpOlGHeL6Vez0nj8Iz7V5n+qFTMuyNjTkOaJtiWgOyjJPHNNEQ WTaCc3KYNF0QT/z9wTQlYt8HDVQlWdNnl8HN/3S0YtpUHdAXaeGcgtQZDJ6lx4I6U+VD mkNA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=S2NyHfSc; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-125193-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-125193-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id b11-20020a05622a020b00b0043116ce6629si4222256qtx.316.2024.03.29.09.56.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Mar 2024 09:56:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-125193-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=S2NyHfSc; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-125193-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-125193-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id BD9CA1C25531 for ; Fri, 29 Mar 2024 16:56:07 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CA24F7E788; Fri, 29 Mar 2024 16:55:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="S2NyHfSc" Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.13]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F2AC3C120; Fri, 29 Mar 2024 16:55:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.13 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711731358; cv=none; b=hIeZMx//3Zh3n1R55J6wJxkPAtqFBjFuxNgskxZ0LIlrU+UY2nIkKgxP/aHw9tTXzpzwNEdE5ejR1MD960lJBcbOAl/AmzzJZE8NfLFzRBhWOaWfQUQQJXr+XCu9w8MS7m0EY/3Lrg5Lpn97byKCo28B9gBK+S64AYJVI2Y8nMM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711731358; c=relaxed/simple; bh=RV3VRFSxY52XIFyp4YJivtHZiq5gbFXa9jWiDKfQaI4=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=qWEPPCQAo6fGTapJQcdUynzztZwTT/81cQQhZ26wOt7JZCxMqiO8oDnIuHaXc/DtznH3Wgv2HilNXfuMxXe2QZed+k5c9ggNnK7PwSNM/C6sLXQf0+MuOMRLx8wlVDexCW/QEUrcDxJCgDjdr0jCeiL584cc1dXlvQ+wUYuWA4k= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=S2NyHfSc; arc=none smtp.client-ip=198.175.65.13 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1711731356; x=1743267356; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=RV3VRFSxY52XIFyp4YJivtHZiq5gbFXa9jWiDKfQaI4=; b=S2NyHfScMD9xphw4hOcvqzBYMn+nEyEm39mNMaIH/XHPW1XQVeNvEiOL v563e73Ljhd3GC/vO2/yiseEg6K8YLYDCOh2wBfB2FMxtVscI8q6zj2SH jHV8T81CPiU6kBSoC6zDrXoS5DSrMwlmvHQZKlK0hIxFLBAelIccde3hu d55vPzNLXkyFeg9PaHJjKTvCJSnkm3W8/n0dhhddpjCA72O8wqgYgv9ke 7y5EYrl3CSkMfOM5626Z/TDm+Obup7vaJxA0vJN1l2Y/9w0o0WQe6giUV 2YrAAcgsVrP3t4jmjsbYCUNXru3f/+kTLpTM65EbZvj4+h7Np+YCa0v/m Q==; X-CSE-ConnectionGUID: ZvOZmYCPSRScSTzfAImb3w== X-CSE-MsgGUID: PHL6ekUSQIKhsOdDXpE2Wg== X-IronPort-AV: E=McAfee;i="6600,9927,11028"; a="18072461" X-IronPort-AV: E=Sophos;i="6.07,165,1708416000"; d="scan'208";a="18072461" Received: from fmviesa008.fm.intel.com ([10.60.135.148]) by orvoesa105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Mar 2024 09:55:55 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,165,1708416000"; d="scan'208";a="17100373" Received: from newjersey.igk.intel.com ([10.102.20.203]) by fmviesa008.fm.intel.com with ESMTP; 29 Mar 2024 09:55:53 -0700 From: Alexander Lobakin To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: Alexander Lobakin , Lorenzo Bianconi , =?UTF-8?q?Toke=20H=C3=B8iland-J=C3=B8rgensen?= , nex.sw.ncis.osdt.itp.upstreaming@intel.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next 0/2] page_pool: allow direct bulk recycling Date: Fri, 29 Mar 2024 17:55:05 +0100 Message-ID: <20240329165507.3240110-1-aleksander.lobakin@intel.com> X-Mailer: git-send-email 2.44.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Previously, there was no reliable way to check whether it's safe to use direct PP cache. The drivers were passing @allow_direct to the PP recycling functions and that was it. Bulk recycling is used by xdp_return_frame_bulk() on .ndo_xdp_xmit() frames completion where the page origin is unknown, thus the direct recycling has never been tried. Now that we have at least 2 ways of checking if we're allowed to perform direct recycling -- pool->p.napi (Jakub) and pool->cpuid (Lorenzo), we can use them when doing bulk recycling as well. Just move that logic from the skb core to the PP core and call it before __page_pool_put_page() every time @allow_direct is false. Under high .ndo_xdp_xmit() traffic load, the win is 2-3% Pps assuming the sending driver uses xdp_return_frame_bulk() on Tx completion. Alexander Lobakin (2): page_pool: check for PP direct cache locality later page_pool: try direct bulk recycling include/linux/skbuff.h | 12 ++++---- net/core/page_pool.c | 38 ++++++++++++++++++++--- net/core/skbuff.c | 70 +++++++++++++----------------------------- net/ipv4/esp4.c | 2 +- net/ipv6/esp6.c | 2 +- 5 files changed, 63 insertions(+), 61 deletions(-) -- 2.44.0