Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp987849pxb; Wed, 3 Mar 2021 23:38:38 -0800 (PST) X-Google-Smtp-Source: ABdhPJx7SVDPKvyYpurqGOBk/mDPiEvvm3gaVJTGLma9k89AT7tTguRQeACkHDFGRab/TDJ6rimy X-Received: by 2002:a17:906:f10c:: with SMTP id gv12mr2808011ejb.53.1614843518007; Wed, 03 Mar 2021 23:38:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614843517; cv=none; d=google.com; s=arc-20160816; b=VeloyErsY6pI9HLtdcBiHcKN3YoxYvmSABYt4E08Jr0zHY0A83XGlsxOExJaUOi3Zz JKrg9sMN3nScGz42T1WClsl12FyXRAw7cWud694gwG/m73acByrQpQzvAE+ZPiYm1+kZ SfvFIweC7Vp4spU8Fk/GEUY+utgts6nVVuBm2j8xKM4aCW0U+1Cnxt6atRQ+p1zbKYqj w5ube5AeYzJbWuCkQ1jLTr+iXZ0+JBgh1RQINLWK3MiK7Sh79PiFBmWsaYk3RJDrB0QN emAk1lpTZzoUQpPzjJUyqouYfwFSAxeCP5z9mIRTBdHZg9Xp6yZJyvsL4ipQLvTqhds6 U6pw== 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=GO9uM42GAO9SsEmJ1Ud/XfdUbUemfb0O0igeT0Ei1wY=; b=LGkPhR71DMomGkNdISjA+HmS5fENvK9qMG/AgG4Ts0h3suN1VnkuZKP7PAEtX1Fizd nZ15xKxDFBrXfhBUsGIuqOLJlhb0j+GNTfKITl+suy5sbk61+Gc6zq3z05jKqmoq0DpA ENuFRAHBwtqicZi9msRt0x3Ho6HIAt4vawzLc+JmmQ88HuN+rM4a7mroZ6b0Q+rD4FTw RQt/dJXgpOKmGkmR4c9BKpmfahe1mLuojZJ4hmi18iLXvxxRczW46VTKBLGEf9Pf2H+o GLEBfs5ujHlJY5Yu+cWwEMcCcKGqM0VBtZdnX6UcR7dmLwRz6mDKclQioFyh8DL9HUVj vehQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=t+mQ5V1Z; 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 ld16si9285323ejb.528.2021.03.03.23.38.07; Wed, 03 Mar 2021 23:38:37 -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=t+mQ5V1Z; 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 S233524AbhCCKf7 (ORCPT + 99 others); Wed, 3 Mar 2021 05:35:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36792 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1577328AbhCBSuV (ORCPT ); Tue, 2 Mar 2021 13:50:21 -0500 Received: from mail-ej1-x62e.google.com (mail-ej1-x62e.google.com [IPv6:2a00:1450:4864:20::62e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EB3B0C061BC3 for ; Tue, 2 Mar 2021 10:49:10 -0800 (PST) Received: by mail-ej1-x62e.google.com with SMTP id gt32so25716913ejc.6 for ; Tue, 02 Mar 2021 10:49:10 -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=GO9uM42GAO9SsEmJ1Ud/XfdUbUemfb0O0igeT0Ei1wY=; b=t+mQ5V1ZRGfRvpmCdmHEuOP/59c00rtGZORfMYX7HKfUuez4VJ7P/g2stb8yyUNxst 3ZAjAlPey5b3CJ3WR9ZbMsryiwCGUNYW/0V8k9FMVnjy6hJjBWpzfjjD5WpEm6YYL4Ab VDVjDBBF9XKN9hploWg3HlOF7IJYNs9JpTZHCCfJCqxXUQNTQhM9W/yR+CCle7AFglTR JwLV/77YC40As4lBp9/jzI2lXuADBhVnmmb+HnWiJk2/vGhM19JJYzR+iTV/3LAzusQI oiynfHyWGcjdPd9LU0vnZFJxy701IOZKSClNV6a/o2PekNWwL2Y9/I8/ZykzPbqZDnFy ynbw== 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=GO9uM42GAO9SsEmJ1Ud/XfdUbUemfb0O0igeT0Ei1wY=; b=r6twJ3HfvMSm5SJGPjLw93iqHvdhuC2kknfVFWzAvR8Wlw+HLbGVGUZoR2qEIh8HMS Z3oH17Yk5OsMqArZg44r74BaNNWcrdOE/z5Pec6/djGZgYkN3MzvOmcv5uvCXVsXqGfg GMoFkJ6KuLCvbhVaYsL/BmBsBm3+zRdx1WQLPOvZW9w13J+BDxqLDDhi/LukHIdpMhl+ 709XKo95KXUsGMZaQ6kJG4PgoTubpCbVRwVlFo3FEUCxAERb6IxsiNvyzEiSPvfoaQgW 3gzJF6uq4HcfFtx9EiPSDLKathd8uRPm3aNsORvjXbHGWTNeC35DhnQ148Mqx5LtFsjk Mx+Q== X-Gm-Message-State: AOAM533a487IXELyBiPlJJX+9bcikbMIhvn8a9chn9AoaCoh6kQmCULz KLegCnZM+SrReiwtliLA1BdoNA== X-Received: by 2002:a17:906:a157:: with SMTP id bu23mr21374870ejb.491.1614710949643; Tue, 02 Mar 2021 10:49:09 -0800 (PST) Received: from enceladus (ppp-94-64-113-158.home.otenet.gr. [94.64.113.158]) by smtp.gmail.com with ESMTPSA id w24sm1645164edt.44.2021.03.02.10.49.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Mar 2021 10:49:09 -0800 (PST) Date: Tue, 2 Mar 2021 20:49:06 +0200 From: Ilias Apalodimas To: Mel Gorman Cc: Andrew Morton , Chuck Lever , Jesper Dangaard Brouer , LKML , Linux-Net , Linux-MM , Linux-NFS Subject: Re: [PATCH 4/5] net: page_pool: refactor dma_map into own function page_pool_dma_map Message-ID: References: <20210301161200.18852-1-mgorman@techsingularity.net> <20210301161200.18852-5-mgorman@techsingularity.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210301161200.18852-5-mgorman@techsingularity.net> Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org Hi Mel, Can you please CC me in future revisions. I almost missed that! On Mon, Mar 01, 2021 at 04:11:59PM +0000, Mel Gorman wrote: > From: Jesper Dangaard Brouer > > In preparation for next patch, move the dma mapping into its own > function, as this will make it easier to follow the changes. > > V2: make page_pool_dma_map return boolean (Ilias) > [...] > static struct page *__page_pool_alloc_pages_slow(struct page_pool *pool, > gfp_t _gfp) > { > + unsigned int pp_flags = pool->p.flags; > struct page *page; > gfp_t gfp = _gfp; > - dma_addr_t dma; > > /* We could always set __GFP_COMP, and avoid this branch, as > * prep_new_page() can handle order-0 with __GFP_COMP. > @@ -211,30 +234,14 @@ static struct page *__page_pool_alloc_pages_slow(struct page_pool *pool, > if (!page) > return NULL; > > - if (!(pool->p.flags & PP_FLAG_DMA_MAP)) > - goto skip_dma_map; > - > - /* Setup DMA mapping: use 'struct page' area for storing DMA-addr > - * since dma_addr_t can be either 32 or 64 bits and does not always fit > - * into page private data (i.e 32bit cpu with 64bit DMA caps) > - * This mapping is kept for lifetime of page, until leaving pool. > - */ > - dma = dma_map_page_attrs(pool->p.dev, page, 0, > - (PAGE_SIZE << pool->p.order), > - pool->p.dma_dir, DMA_ATTR_SKIP_CPU_SYNC); > - if (dma_mapping_error(pool->p.dev, dma)) { > + if (pp_flags & PP_FLAG_DMA_MAP && Nit pick but can we have if ((pp_flags & PP_FLAG_DMA_MAP) && ... > + unlikely(!page_pool_dma_map(pool, page))) { > put_page(page); > return NULL; > } > - page->dma_addr = dma; > > - if (pool->p.flags & PP_FLAG_DMA_SYNC_DEV) > - page_pool_dma_sync_for_device(pool, page, pool->p.max_len); > - > -skip_dma_map: > /* Track how many pages are held 'in-flight' */ > pool->pages_state_hold_cnt++; > - > trace_page_pool_state_hold(pool, page, pool->pages_state_hold_cnt); > > /* When page just alloc'ed is should/must have refcnt 1. */ > -- > 2.26.2 > Otherwise Reviewed-by: Ilias Apalodimas