All of lore.kernel.org
 help / color / mirror / Atom feed
From: Joerg Roedel <joro@8bytes.org>
To: Tomasz Figa <tfiga@chromium.org>
Cc: iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org,
	Robin Murphy <robin.murphy@arm.com>
Subject: Re: [PATCH v2 2/2] iommu/dma: Use __GFP_NOWARN only for high-order allocations
Date: Wed, 26 Jul 2017 11:24:11 +0200	[thread overview]
Message-ID: <20170726092411.GD15833@8bytes.org> (raw)
In-Reply-To: <20170704135556.21704-2-tfiga@chromium.org>

On Tue, Jul 04, 2017 at 10:55:56PM +0900, Tomasz Figa wrote:
> diff --git a/drivers/iommu/dma-iommu.c b/drivers/iommu/dma-iommu.c
> index bf23989b5158..6ed8c8f941d8 100644
> --- a/drivers/iommu/dma-iommu.c
> +++ b/drivers/iommu/dma-iommu.c
> @@ -433,6 +433,7 @@ static struct page **__iommu_dma_alloc_pages(unsigned int count,
>  {
>  	struct page **pages;
>  	unsigned int i = 0, array_size = count * sizeof(*pages);
> +	const gfp_t high_order_gfp = __GFP_NOWARN | __GFP_NORETRY;
>  
>  	order_mask &= (2U << MAX_ORDER) - 1;
>  	if (!order_mask)
> @@ -452,8 +453,6 @@ static struct page **__iommu_dma_alloc_pages(unsigned int count,
>  	if (!(gfp & (__GFP_DMA | __GFP_DMA32)))
>  		gfp |= __GFP_HIGHMEM;
>  
> -	gfp |= __GFP_NOWARN;
> -

Okay, so a warning should be there if allocation fails, independent of
what the allocation order is. So either this function prints a message
in case of allocation failure or we remove __GFP_NOWARN for all
allocation attempts.

Adding __GFP_NOWARN only makes sense when there is another fall-back in
case allocation fails anyway, which is not the case here.

>  	while (count) {
>  		struct page *page = NULL;
>  		unsigned int order_size;
> @@ -469,7 +468,7 @@ static struct page **__iommu_dma_alloc_pages(unsigned int count,
>  
>  			order_size = 1U << order;
>  			page = alloc_pages((order_mask - order_size) ?
> -					   gfp | __GFP_NORETRY : gfp, order);
> +					   gfp | high_order_gfp : gfp, order);

Why does it specify __GFP_NORETRY at all? The alloc-routines in the
DMA-API don't need to be atomic.


	Joerg

  reply	other threads:[~2017-07-26  9:24 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-04 13:55 [PATCH v2 1/2] iommu/dma: Respect __GFP_DMA and __GFP_DMA32 in incoming GFP flags Tomasz Figa
2017-07-04 13:55 ` Tomasz Figa
     [not found] ` <20170704135556.21704-1-tfiga-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
2017-07-04 13:55   ` [PATCH v2 2/2] iommu/dma: Use __GFP_NOWARN only for high-order allocations Tomasz Figa
2017-07-04 13:55     ` Tomasz Figa
2017-07-26  9:24     ` Joerg Roedel [this message]
     [not found]       ` <20170726092411.GD15833-zLv9SwRftAIdnm+yROfE0A@public.gmane.org>
2017-07-26  9:29         ` Tomasz Figa
2017-07-26  9:29           ` Tomasz Figa
2017-07-26  9:15 ` [PATCH v2 1/2] iommu/dma: Respect __GFP_DMA and __GFP_DMA32 in incoming GFP flags Joerg Roedel
     [not found]   ` <20170726091545.GC15833-zLv9SwRftAIdnm+yROfE0A@public.gmane.org>
2017-07-26  9:26     ` Tomasz Figa
2017-07-26  9:26       ` Tomasz Figa

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=20170726092411.GD15833@8bytes.org \
    --to=joro@8bytes.org \
    --cc=iommu@lists.linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=robin.murphy@arm.com \
    --cc=tfiga@chromium.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.