Re: [PATCH v4] iommu/tegra-smmu: Add locking around mapping operations

From: Dmitry Osipenko
Date: Tue Sep 01 2020 - 14:56:46 EST


01.09.2020 20:13, Dmitry Osipenko пишет:
...
> + /*
> + * In order to prevent exhaustion of the atomic memory pool, we
> + * allocate page in a sleeping context if GFP flags permit. Hence
> + * spinlock needs to be unlocked and re-locked after allocation.
> + */
> + if (!(gfp & GFP_NOWAIT))
> + spin_unlock_irqrestore(&as->lock, *flags);
> +
> + page = alloc_page(gfp | __GFP_DMA | __GFP_ZERO);
> +
> + if (!(gfp & GFP_NOWAIT))
> + spin_lock_irqsave(&as->lock, *flags);

I realized that GFP_NOWAIT is a wrong flag to check here once I saw
warnings about sleeping in atomic context. Apparently __GFP_ATOMIC
should be used instead, I'll make v5.