Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3302075pxf; Mon, 15 Mar 2021 06:41:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxRghgflJc/iGS5aI+IYyDNeLf+/p2XyXtP9kKwGCfFy/ZeL+UrQIgcbQY/xGUZh/6DjW+5 X-Received: by 2002:a05:6402:12d5:: with SMTP id k21mr30546305edx.318.1615815668307; Mon, 15 Mar 2021 06:41:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615815668; cv=none; d=google.com; s=arc-20160816; b=a7JYhT4WHZbLLkW6d4dZIqkHPX2YEW4CNjIIXA6ftRo8CYI55QASyDf8x3yqeUw6os 5kq9tNDGLj8dDBfsUGr2gqretsBxzc2VshOD/f/iRkcPwv2i37zgWCP+BgRKiMvr6TpH S5oLhIoOavwJaX301rXTXqTz7l++G3aN39EMgRXUFHE/X4/KZ5/J+K4lQ8aYBngaYaal EMSm/Qkhdw9OG5hv7CIRY7DmGvnTzmJ0o854/RD2+AMGHkLXAwMd1QVXhFDGzkZhwWDR TWqjTkCtV4MlmPR4OIZX8Bj9eTDfFDR7jFTwj61d47XyvPNo44HAx10OK7XleVsm+7cv fPmQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=FBloEIKc9d+TaaEDfCG9lNf3Br/ubHPcgUeOPhTr6GA=; b=mvV/7QawdO8QNEuaIJyWJiFvp//4eRYSypKUu/H7j5mBM7PNjMgFmdE+8BiwyCOWOU rG9ZVpN2mbQ5eHW88VPJp0+ogD1VNuM0LeOBM0IbLDBDFtRtyT47Jyl9A0gwfVS2GiQc xKIk8kOdyWxu6RxtdvOzsBQnYweypdPgQa+OwsoTyjSA45+Q15z9yLLB1zuQxBpOy2sw 947LMHtn4yS5bysCwh1w1kgBOoXfGM19R7NwFu8DKslQajnEKmdkjb50lBoEuoA17unC waIfVzDOcKeg0Zqe/SRy+wuY393tPmdkPiJTcyr5K3Xv4bKoPI31xDRfvSglffG9smtg z0LA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=fAib18ch; 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=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c11si11011136ede.102.2021.03.15.06.40.35; Mon, 15 Mar 2021 06:41:08 -0700 (PDT) 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=@redhat.com header.s=mimecast20190719 header.b=fAib18ch; 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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229601AbhCONkB (ORCPT + 99 others); Mon, 15 Mar 2021 09:40:01 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:49363 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229723AbhCONjl (ORCPT ); Mon, 15 Mar 2021 09:39:41 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1615815581; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=FBloEIKc9d+TaaEDfCG9lNf3Br/ubHPcgUeOPhTr6GA=; b=fAib18chOSq3hyNwapsvA8l8v/dGE7e8K1sa9ixGXdMkAiHJ+Vj1GRHUFAKrDJ1N9/tKhe HZB6mzRLDNyHb3JilJgmwGYNBbuAHvj/qpNOeFsS93DFq9yWO5A7sWg7FB0NyUnfi4sl5y BQcPL8TFR2BIOb/jmGhJzQS+J9gdKc0= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-574-jeXUEtpqMLCSpUTFmj-UZg-1; Mon, 15 Mar 2021 09:39:37 -0400 X-MC-Unique: jeXUEtpqMLCSpUTFmj-UZg-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 7338E809AC7; Mon, 15 Mar 2021 13:39:35 +0000 (UTC) Received: from carbon (unknown [10.36.110.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7292118AAF; Mon, 15 Mar 2021 13:39:29 +0000 (UTC) Date: Mon, 15 Mar 2021 14:39:28 +0100 From: Jesper Dangaard Brouer To: Ilias Apalodimas Cc: Alexander Duyck , Mel Gorman , Andrew Morton , Chuck Lever , Christoph Hellwig , Matthew Wilcox , LKML , Linux-Net , Linux-MM , Linux-NFS , brouer@redhat.com Subject: Re: [PATCH 7/7] net: page_pool: use alloc_pages_bulk in refill code path Message-ID: <20210315143928.5d94da8f@carbon> In-Reply-To: References: <20210312154331.32229-1-mgorman@techsingularity.net> <20210312154331.32229-8-mgorman@techsingularity.net> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org On Fri, 12 Mar 2021 22:05:45 +0200 Ilias Apalodimas wrote: > [...] > > 6. return last_page > > > > > + /* 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) && > > > + unlikely(!page_pool_dma_map(pool, page))) { > > > + put_page(page); > > > + continue; > > > + } > > > > So if you added a last_page pointer what you could do is check for it > > here and assign it to the alloc cache. If last_page is not set the > > block would be skipped. > > > > > + 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); > > > > If you are just calling put_page here aren't you leaking DMA mappings? > > Wouldn't you need to potentially unmap the page before you call > > put_page on it? > > Oops, I completely missed that. Alexander is right here. Well, the put_page() case can never happen as the pool->alloc.cache[] is known to be empty when this function is called. I do agree that the code looks cumbersome and should free the DMA mapping, if it could happen. -- Best regards, Jesper Dangaard Brouer MSc.CS, Principal Kernel Engineer at Red Hat LinkedIn: http://www.linkedin.com/in/brouer