CMA region and highmem

Marek Szyprowski m.szyprowski at samsung.com
Thu Jan 22 23:26:52 PST 2015


Hello,

On 2015-01-22 21:55, Daniel Drake wrote:
> On Thu, Aug 21, 2014 at 3:32 AM, Marek Szyprowski
> <m.szyprowski at samsung.com> wrote:
>> You are right, but frankly drivers doing large DMA allocations should take
>> advantage of DMA_ATTR_NO_KERNEL_MAPPING DMA attribute, because all they
>> usually do is just mapping those buffers to userspace. For a bit complex
>> example, see drivers/gpu/drm/exynos/exynos_drm_buf.c or
>> drivers/gpu/drm/msm/msm_drv.c.
> Thanks again for the insight here. Revisiting this topic now:
>
> Looking at DMA_ATTR_NO_KERNEL_MAPPING in latest linus git, this only
> seems to be implemented for IOMMU setups.
> On other setups this flag seems to be ignored, so on such setups, your
> change that tends to place the CMA region in high memory now puts
> pressure on the vmalloc area even when the driver asked for
> NO_KERNEL_MAPPING.
>
> Is there a good reason why the non-IOMMU codepath doesn't obey
> DMA_ATTR_NO_KERNEL_MAPPING?

No, it simply has not been implemented yet. Mainly because initially CMA
regions were allocated in low memory and all my development boards that time
didn't have enough memory to experiment with high mem...

> We ran a quick experiment here
> implementing this (i.e. just bailing out of __alloc_from_contiguous
> before mapping the memory into kernel space) and it seems to work.

Right. This should be enough. Feel free to submit a patch.

Best regards
-- 
Marek Szyprowski, PhD
Samsung R&D Institute Poland




More information about the linux-arm-kernel mailing list