Re: [PATCH v2 2/2] dma-pool: Only allocate from CMA when in same memory zone

Christoph Hellwig
2020-08-04T06:06:38Z

On Mon, Aug 03, 2020 at 06:09:56PM +0200, Nicolas Saenz Julienne wrote:
> + if (IS_ENABLED(CONFIG_ZONE_DMA) && (gfp & GFP_DMA))
> + return end <= DMA_BIT_MASK(zone_dma_bits);
> + if (IS_ENABLED(CONFIG_ZONE_DMA32) && (gfp & GFP_DMA32))
> + return end <= DMA_BIT_MASK(32);
> + if (gfp & GFP_KERNEL)
> + return end > DMA_BIT_MASK(32);

So the GFP_KERNEL one here looks weird. For one I don't think the if
line is needed at all, and it just confuses things. Second I don't
see the need (and actually some harm) in preventing GFP_KERNEL
allocations from dipping into lower CMA areas - something that we did
support before 5.8 with the single pool.