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 5FF47C433E0 for ; Wed, 24 Feb 2021 20:15:28 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id F00A864E60 for ; Wed, 24 Feb 2021 20:15:27 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org F00A864E60 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 7D0CA8D0066; Wed, 24 Feb 2021 15:15:27 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 781418D0063; Wed, 24 Feb 2021 15:15:27 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 671118D0066; Wed, 24 Feb 2021 15:15:27 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0203.hostedemail.com [216.40.44.203]) by kanga.kvack.org (Postfix) with ESMTP id 501068D0063 for ; Wed, 24 Feb 2021 15:15:27 -0500 (EST) Received: from smtpin02.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 22329FB51 for ; Wed, 24 Feb 2021 20:15:27 +0000 (UTC) X-FDA: 77854266294.02.7BDFC57 Received: from mail-wm1-f46.google.com (mail-wm1-f46.google.com [209.85.128.46]) by imf01.hostedemail.com (Postfix) with ESMTP id EFB902000390 for ; Wed, 24 Feb 2021 20:15:25 +0000 (UTC) Received: by mail-wm1-f46.google.com with SMTP id n4so1516324wmq.3 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=j4aSmSaQMsku5W9l9tMXHigbGuy+AAa2eALNOX3Q02hwkUfzFaanXtYlyWbHVoHDL3 5Dmn4bhVvDJ48IqcMaCsg1F0eS/vXPO8ak9lgo4W351d45tvUz0FIWB0mqCkFbz+okiZ 9Khf4gbTGiAWxFBHPkPeD/pzpl7ETwfA6jcy5RKdr9yG5G+rf6YO0qU06RC/ylnaC4SP s2aVBuyHWcbhzlJugkjAuT8hDeDNuhTxCrz8qeo2AE5LJslX0WNMTXJ6tYas8TYOcaMT gZvvkCd+GbORrnFeN2k8Ff5GFLc40Cm3adI14lnVMeMdi7dAE7vKsMNI9egakwoYBAV7 t/5w== X-Gm-Message-State: AOAM53218ug/LdH/Z8wRcqZKU96QB80WG4wHQJ/7BrivAMzanLXsFzc9 xECq0GH8zBh9gXCGeaYptUO/oQ== 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> X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: EFB902000390 X-Stat-Signature: 9nws99arz7c8c3bdcpqechmo5kiz8ami Received-SPF: none (linaro.org>: No applicable sender policy available) receiver=imf01; identity=mailfrom; envelope-from=""; helo=mail-wm1-f46.google.com; client-ip=209.85.128.46 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1614197725-228230 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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