Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1416150 > unrolled thread

CMA region absolutely for a particular device?

Started byShawn Guo <shawnguo@kernel.org>
First post2016-06-07 15:10 +0200
Last post2016-06-08 13:10 +0200
Articles 3 — 2 participants

Back to article view | Back to linux.kernel


Contents

  CMA region absolutely for a particular device? Shawn Guo <shawnguo@kernel.org> - 2016-06-07 15:10 +0200
    Re: CMA region absolutely for a particular device? Laura Abbott <labbott@redhat.com> - 2016-06-07 18:00 +0200
      Re: CMA region absolutely for a particular device? Shawn Guo <shawnguo@kernel.org> - 2016-06-08 13:10 +0200

#1416150 — CMA region absolutely for a particular device?

FromShawn Guo <shawnguo@kernel.org>
Date2016-06-07 15:10 +0200
SubjectCMA region absolutely for a particular device?
Message-ID<rHoVA-37S-45@gated-at.bofh.it>
Hi,

I'm using a separate CMA region than the system default one for
a particular device to avoid fragmentation.  It does help.  But under
certain circumstance (memory shortage), it seems some of the pages in
the region will be used by system.  The really bad thing is that when
a CMA allocation tries to move these occupied pages around, it just
fails to do so with messages like "alloc_contig_range: ... PFNs busy".
These pages thus become holes in a contiguous block and prevent the
allocation from succeeding.

Is it possible to make a CMA absolutely for a particular device, and
even system movable pages cannot use the memory?  I can reserve a memory
region from kernel and manage it with some custom and private interface
for that particular device.  But obviously, the standard dma-mapping API
and established underneath CMA infrastructural is more desirable to use,
right?

This is an arm64 device running on 4.1 kernel.  Any comments or
suggestions will be appreciated.  Thanks.

Shawn

[toc] | [next] | [standalone]


#1416339

FromLaura Abbott <labbott@redhat.com>
Date2016-06-07 18:00 +0200
Message-ID<rHrA6-4yQ-29@gated-at.bofh.it>
In reply to#1416150
On 06/07/2016 05:59 AM, Shawn Guo wrote:
> Hi,
>
> I'm using a separate CMA region than the system default one for
> a particular device to avoid fragmentation.  It does help.  But under
> certain circumstance (memory shortage), it seems some of the pages in
> the region will be used by system.  The really bad thing is that when
> a CMA allocation tries to move these occupied pages around, it just
> fails to do so with messages like "alloc_contig_range: ... PFNs busy".
> These pages thus become holes in a contiguous block and prevent the
> allocation from succeeding.
>
> Is it possible to make a CMA absolutely for a particular device, and
> even system movable pages cannot use the memory?  I can reserve a memory
> region from kernel and manage it with some custom and private interface
> for that particular device.  But obviously, the standard dma-mapping API
> and established underneath CMA infrastructural is more desirable to use,
> right?
>
> This is an arm64 device running on 4.1 kernel.  Any comments or
> suggestions will be appreciated.  Thanks.
>
> Shawn
>

You could try backporting the ZONE_CMA patches
http://article.gmane.org/gmane.linux.kernel.mm/152016 . The primary problem
there was CMA utilization but there was some discussion about migration
success as well http://article.gmane.org/gmane.linux.kernel/2228789

If that doesn't work for you, I think the 'reusable' property can be dropped
and it should just become a DMA coherent pool. I haven't tested this though.

Thanks,
Laura

[toc] | [prev] | [next] | [standalone]


#1417284

FromShawn Guo <shawnguo@kernel.org>
Date2016-06-08 13:10 +0200
Message-ID<rHJwZ-7QB-5@gated-at.bofh.it>
In reply to#1416339
On Tue, Jun 7, 2016 at 11:55 PM, Laura Abbott <labbott@redhat.com> wrote:
> You could try backporting the ZONE_CMA patches
> http://article.gmane.org/gmane.linux.kernel.mm/152016 . The primary problem
> there was CMA utilization but there was some discussion about migration
> success as well http://article.gmane.org/gmane.linux.kernel/2228789

Thanks much for the pointers, Laura.

> If that doesn't work for you, I think the 'reusable' property can be dropped
> and it should just become a DMA coherent pool. I haven't tested this though.

I will see if I can test it out.

Shawn

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web