linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Randy Dunlap <rdunlap@infradead.org>
To: Christoph Hellwig <hch@lst.de>, iommu@lists.linux-foundation.org
Cc: Marek Szyprowski <m.szyprowski@samsung.com>,
	Robin Murphy <robin.murphy@arm.com>,
	Benjamin Herrenschmidt <benh@kernel.crashing.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] dma-direct: document the zone selection logic
Date: Mon, 1 Oct 2018 13:22:11 -0700	[thread overview]
Message-ID: <4e9fd184-2ee4-1971-dcd9-34bfb8c05f65@infradead.org> (raw)
In-Reply-To: <20181001201016.32639-2-hch@lst.de>

On 10/1/18 1:10 PM, Christoph Hellwig wrote:
> What we are doing here isn't quite obvious, so add a comment explaining
> it.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>  kernel/dma/direct.c | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/kernel/dma/direct.c b/kernel/dma/direct.c
> index ba6f5956a291..14b966e2349a 100644
> --- a/kernel/dma/direct.c
> +++ b/kernel/dma/direct.c
> @@ -84,7 +84,14 @@ static gfp_t __dma_direct_optimal_gfp_mask(struct device *dev, u64 dma_mask,
>  	else
>  		*phys_mask = dma_to_phys(dev, dma_mask);
>  
> -	/* GFP_DMA32 and GFP_DMA are no ops without the corresponding zones: */
> +	/*
> +	 * Optimistically try the zone that the physicall address mask falls

	                                        physical

> +	 * into first.  If that returns memory that isn't actually addressable
> +	 * we will fallback to the next lower zone and try again.
> +	 *
> +	 * Note that GFP_DMA32 and GFP_DMA are no ops without the corresponding
> +	 * zones.
> +	 */
>  	if (*phys_mask <= DMA_BIT_MASK(ARCH_ZONE_DMA_BITS))
>  		return GFP_DMA;
>  	if (*phys_mask <= DMA_BIT_MASK(32))
> 

thanks for the documentation.

-- 
~Randy

  reply	other threads:[~2018-10-01 20:22 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-01 20:10 document dma-direct zone selection Christoph Hellwig
2018-10-01 20:10 ` [PATCH] dma-direct: document the zone selection logic Christoph Hellwig
2018-10-01 20:22   ` Randy Dunlap [this message]
2018-10-08  7:03   ` Christoph Hellwig
2018-10-08 22:56     ` Benjamin Herrenschmidt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4e9fd184-2ee4-1971-dcd9-34bfb8c05f65@infradead.org \
    --to=rdunlap@infradead.org \
    --cc=benh@kernel.crashing.org \
    --cc=hch@lst.de \
    --cc=iommu@lists.linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=m.szyprowski@samsung.com \
    --cc=robin.murphy@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).