Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp690391pxb; Wed, 24 Feb 2021 12:19:02 -0800 (PST) X-Google-Smtp-Source: ABdhPJwSlQ6UXY+9BVuMoj0S919DFAnXuPUmcKexun7aLhWubOe5/wKfwy7BGSQ/HUixFDfFTH5A X-Received: by 2002:a17:906:5902:: with SMTP id h2mr31982045ejq.137.1614197942689; Wed, 24 Feb 2021 12:19:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614197942; cv=none; d=google.com; s=arc-20160816; b=zXEH0LAzWmxOXBRrrzo3SE7+5LIsKGVOFmLKCuAfX6xtDmA7k6P2sGMP7yokOrIEK8 PYPiNCh/j+P+6KbAY9lw+Xog2e0r4WsNYRvlObotw+MTQTRSupU+UDpdGh/cAxaoWqsm /bXwzPYusPwSDS43gN9Tvn2kv4mgola+9+Q/AnyNbYm3gkplzsTekYtMYOZW5coSDMSw YcrSMjcTJVuayS0hkkHkkUfXKlxbyc24apAJzV1TlWgQyV+pdUtOs7xecMEZwa40B+rq dDsjRL5JOHDzTOxBxT1OC/XBscQXxmFhrwSXpzYjw/GnJiFYpM+Uoy/g9Qd3j29vuDeQ MvBw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=J1gJV1o9Sl1Wnh9xWJQFa/KkawfMsaygfgB8RdQE8os=; b=PqA7HJjFh48jZzHi+jdfWtPjIPZAor+Lq09iaDny9/CXSxsO+1gnJxzJCHxHRx3z0S yt1q0dQYqjBFrglTmV30gvbnpucq5y+OCCm4yxlcX+b3fsHVKaZCMenKIg+0nH0WG/Sn 6Oi48yLkNgD3eqBQ6bz/d8KawN15gmb1PD2KxhNyq+Z7Ts7Z71xljR8vpvOwyqfW1jEh sJW7jRPZGlMdKEmeg1JVa9Tby+vDCobcUkvMH9BUMxQBirX4jTb4po3PvYDpo42pyN7e rJ1OmpvqGubbBQaC3iO51OEHXWjarLJ2cFWKKBzCw5otOEzUfF7s8gzzuf7jP6a9OTwG pDTw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=PcA0tffJ; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q7si1787618edt.86.2021.02.24.12.18.38; Wed, 24 Feb 2021 12:19:02 -0800 (PST) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=PcA0tffJ; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235547AbhBXURX (ORCPT + 99 others); Wed, 24 Feb 2021 15:17:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45306 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235685AbhBXUQH (ORCPT ); Wed, 24 Feb 2021 15:16:07 -0500 Received: from mail-wm1-x32e.google.com (mail-wm1-x32e.google.com [IPv6:2a00:1450:4864:20::32e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BFB7CC06174A for ; Wed, 24 Feb 2021 12:15:26 -0800 (PST) Received: by mail-wm1-x32e.google.com with SMTP id i9so2545741wml.0 for ; Wed, 24 Feb 2021 12:15:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=J1gJV1o9Sl1Wnh9xWJQFa/KkawfMsaygfgB8RdQE8os=; b=PcA0tffJHzRc0QDxWkZcmb6WbGBYLYs9WEMRBSGCgpFlPrgGJCTauBZS1e0nR+TIuo P7bS/cIRp3mXEScNS+sPOjB/weotyBiu2bFS8B4AIMQmUHok6E0B6AqYR3HHAytYr24i uN8Z4aDXQlcyRdC8w9kyOasCEF5+QrJ0cMzcCNw7vE4fgPegZEsEMmV9qVhb+IEOTzYA Kng0odzvZpmNLSNsAfEgTkIEpPQYeei+X7ma2gcmv4yxuiRcwOtHljf2UzuxtGwIGhVd M8mDL6Ir4geuuDKHscHvoJ6c5rfKglpo4UMtOUmkY3h9yFYWzfiF7Cz65NRfB9RHhRnT vkKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=J1gJV1o9Sl1Wnh9xWJQFa/KkawfMsaygfgB8RdQE8os=; b=unQqLQUBAuEeDUiC3U4vOgC0GohyaAr+iUZidGVxa6+SOhSXLehc3oQ7uNby4kYJgo LY/FD1iEPkE9OVhmDInnXigPaS5ArjL0lgtGTnGfEjyGRq2VsYFJdWcgXqng9n20FPhM o8UynZ75VGI5ZOpZnh+5QsABxsgd1dw6rv7HfoIzeqAHx43dUKKKl/Md1zTPsUG0seR/ 2+VpKbz+2z3zHIcDs91co3b+FRx1dfGvjJrf+HH1R7/JUTNYHZ5XBfS46O+dEpT4WeXc fv1xVGz4xdEsg75iSGB8jTg+td1V3gegVSs/Jrh8dPn+eAtX9d3L1ydrFfS9Rp3kb50V 07SQ== X-Gm-Message-State: AOAM530RRETmhz9NXiS2039t8OT2C1aI1KBcxaPutSw0T9ST9K+1sP3/ tqV/MNmY9KIwWadGtath9oX/GWTiaL8W6+4T X-Received: by 2002:a1c:f60b:: with SMTP id w11mr5227838wmc.3.1614197725456; Wed, 24 Feb 2021 12:15:25 -0800 (PST) Received: from apalos.home (ppp-94-64-113-158.home.otenet.gr. [94.64.113.158]) by smtp.gmail.com with ESMTPSA id y9sm1850442wrm.88.2021.02.24.12.15.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Feb 2021 12:15:25 -0800 (PST) Date: Wed, 24 Feb 2021 22:15:22 +0200 From: Ilias Apalodimas To: Jesper Dangaard Brouer Cc: Mel Gorman , linux-mm@kvack.org, chuck.lever@oracle.com, netdev@vger.kernel.org, linux-nfs@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH RFC net-next 2/3] net: page_pool: use alloc_pages_bulk in refill code path Message-ID: References: <161419296941.2718959.12575257358107256094.stgit@firesoul> <161419300618.2718959.11165518489200268845.stgit@firesoul> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <161419300618.2718959.11165518489200268845.stgit@firesoul> Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org Hi Jesper, On Wed, Feb 24, 2021 at 07:56:46PM +0100, Jesper Dangaard Brouer wrote: > There are cases where the page_pool need to refill with pages from the > page allocator. Some workloads cause the page_pool to release pages > instead of recycling these pages. > > For these workload it can improve performance to bulk alloc pages from > the page-allocator to refill the alloc cache. > > For XDP-redirect workload with 100G mlx5 driver (that use page_pool) > redirecting xdp_frame packets into a veth, that does XDP_PASS to create > an SKB from the xdp_frame, which then cannot return the page to the > page_pool. In this case, we saw[1] an improvement of 18.8% from using > the alloc_pages_bulk API (3,677,958 pps -> 4,368,926 pps). > > [1] https://github.com/xdp-project/xdp-project/blob/master/areas/mem/page_pool06_alloc_pages_bulk.org > > Signed-off-by: Jesper Dangaard Brouer [...] > + /* Remaining pages store in alloc.cache */ > + list_for_each_entry_safe(page, next, &page_list, lru) { > + list_del(&page->lru); > + if (pp_flags & PP_FLAG_DMA_MAP) { > + page = page_pool_dma_map(pool, page); > + if (!page) As I commented on the previous patch, i'd prefer the put_page() here to be explicitly called, instead of hiding in the page_pool_dma_map() > + continue; > + } > + if (likely(pool->alloc.count < PP_ALLOC_CACHE_SIZE)) { > + pool->alloc.cache[pool->alloc.count++] = page; > + pool->pages_state_hold_cnt++; > + trace_page_pool_state_hold(pool, page, > + pool->pages_state_hold_cnt); > + } else { > + put_page(page); > + } > + } > +out: > if (pool->p.flags & PP_FLAG_DMA_MAP) { > - page = page_pool_dma_map(pool, page); > - if (!page) > + first_page = page_pool_dma_map(pool, first_page); > + if (!first_page) > return NULL; > } > [...] Cheers /Ilias