mbox series

[v2,RFC/RFT,0/5] Save single pages from CMA area

Message ID 20190326230131.16275-1-nicoleotsuka@gmail.com (mailing list archive)
Headers show
Series Save single pages from CMA area | expand

Message

Nicolin Chen March 26, 2019, 11:01 p.m. UTC
This series of patches try to save single pages from CMA area bypassing
all CMA single page alloctions and allocating normal pages instead, as
all addresses within one single page are contiguous.

We had once applied the PATCH-5 but reverted it as actually not all the
callers handled the fallback allocations. Per Robin's suggestion, let's
stuff alloc_pages()/free_page() fallbacks to those callers before having
PATCH-5.

Changlog
v1->v2:
 * PATCH-2: Initialized page pointer to NULL

Nicolin Chen (5):
  ARM: dma-mapping: Add fallback normal page allocations
  dma-remap: Run alloc_pages() on failure
  iommu: amd_iommu: Add fallback normal page allocations
  arm64: dma-mapping: Add fallback normal page allocations
  dma-contiguous: Do not allocate a single page from CMA area

 arch/arm/mm/dma-mapping.c   | 13 ++++++++++---
 arch/arm64/mm/dma-mapping.c | 19 ++++++++++++-------
 drivers/iommu/amd_iommu.c   |  3 +++
 kernel/dma/contiguous.c     | 22 +++++++++++++++++++---
 kernel/dma/remap.c          |  4 ++--
 5 files changed, 46 insertions(+), 15 deletions(-)

Comments

Christoph Hellwig March 27, 2019, 8:08 a.m. UTC | #1
On Tue, Mar 26, 2019 at 04:01:26PM -0700, Nicolin Chen wrote:
> This series of patches try to save single pages from CMA area bypassing
> all CMA single page alloctions and allocating normal pages instead, as
> all addresses within one single page are contiguous.
> 
> We had once applied the PATCH-5 but reverted it as actually not all the
> callers handled the fallback allocations. Per Robin's suggestion, let's
> stuff alloc_pages()/free_page() fallbacks to those callers before having
> PATCH-5.

Given the problems this has caused so far I'd like to see a good
explanation of why this optimization is so important that all the churn
is even worth it..
Nicolin Chen March 27, 2019, 6:42 p.m. UTC | #2
On Wed, Mar 27, 2019 at 09:08:21AM +0100, Christoph Hellwig wrote:
> On Tue, Mar 26, 2019 at 04:01:26PM -0700, Nicolin Chen wrote:
> > This series of patches try to save single pages from CMA area bypassing
> > all CMA single page alloctions and allocating normal pages instead, as
> > all addresses within one single page are contiguous.
> > 
> > We had once applied the PATCH-5 but reverted it as actually not all the
> > callers handled the fallback allocations. Per Robin's suggestion, let's
> > stuff alloc_pages()/free_page() fallbacks to those callers before having
> > PATCH-5.
> 
> Given the problems this has caused so far I'd like to see a good
> explanation of why this optimization is so important that all the churn
> is even worth it..

With certain downstream user cases, we had run into a CMA exhaustion
situation, and this was one of the changes that eased the problem. I
have all the reasoning in the PATCH-5 commit message. And what Robin
tested can also justify for it:
https://lore.kernel.org/patchwork/patch/1004934/#1190139

Thanks