From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CBF6CC433E0 for ; Wed, 24 Feb 2021 20:17:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8A29F60202 for ; Wed, 24 Feb 2021 20:17:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235547AbhBXURX (ORCPT ); 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-Google-Smtp-Source: ABdhPJxf2wBacwv+7nH21lGN1XxSnXmyTznri5GC7Ka7XM0MNYSpX5qm+NtljVGMt7wCrErHGVhWNQ== 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