Skip to contentSkip to conversation

cma: make default CMA area size zero for x86

PATCH In review Akinobu Mita 2 participants 2 messages Oct 5, 2014 – Oct 6, 2014 Driver core

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 cma: make default CMA area size zero for x86

This makes CMA memory area size zero for x86 in default configuration (doesn't change on the other architectures). If default CMA size is zero, DMA_CMA is disabled. It can be enabled by passing cma= to the kernel.

This makes less impact on x86. Because there is no mainline driver that requires it for x86, and Peter Hurley reported the performance regression, as this is trying to drive _all_ dma mapping allocations through a _very_ small window.

Cc Peter Hurley <[email protected]>
Cc Chuck Ebbert <[email protected]>
Cc Jean Delvare <[email protected]>
Cc Marek Szyprowski <[email protected]>
Cc Konrad Rzeszutek Wilk <[email protected]>
Cc David Woodhouse <[email protected]>
Cc Don Dutile <[email protected]>
Cc Thomas Gleixner <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc "H. Peter Anvin" <[email protected]>
Cc Andi Kleen <andi-Vw/[email protected]>
Cc Yinghai Lu <[email protected]>
Cc iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org

---
* v2
- Add information in help text, suggested by Chuck Ebbert

 drivers/base/Kconfig | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/base/Kconfig +7 -1
index 4e7f0ff..115882f 100644
@@ -240,18 +240,24 @@ comment "Default contiguous memory area size:"
 config CMA_SIZE_MBYTES
 	int "Size in Mega Bytes"
 	depends on !CMA_SIZE_SEL_PERCENTAGE
+	default 0 if X86
 	default 16
 	help
 	  Defines the size (in MiB) of the default memory area for Contiguous
-	  Memory Allocator.
+	  Memory Allocator.  If the size of 0 is selected, CMA is disabled by
+	  default, but it can be enabled by passing cma=size[MG] to the kernel.
+
 
 config CMA_SIZE_PERCENTAGE
 	int "Percentage of total memory"
 	depends on !CMA_SIZE_SEL_MBYTES
+	default 0 if X86
 	default 10
 	help
 	  Defines the size of the default memory area for Contiguous Memory
 	  Allocator as a percentage of the total memory in the system.
+	  If 0 percent is selected, CMA is disabled by default, but it can be
+	  enabled by passing cma=size[MG] to the kernel.
 
 choice
 	prompt "Selected region size"
Signature · 1 line
1.9.1
Acked-by on v2 1/1
#1 lore raw

Hello,

Quoted 10 lines · Akinobu Mita

This makes CMA memory area size zero for x86 in default configuration (doesn't change on the other architectures). If default CMA size is zero, DMA_CMA is disabled. It can be enabled by passing cma= to the kernel.

This makes less impact on x86. Because there is no mainline driver that requires it for x86, and Peter Hurley reported the performance regression, as this is trying to drive _all_ dma mapping allocations through a _very_ small window.

Quoted 16 lines
Cc Peter Hurley <[email protected]>
Cc Chuck Ebbert <[email protected]>
Cc Jean Delvare <[email protected]>
Cc Marek Szyprowski <[email protected]>
Cc Konrad Rzeszutek Wilk <[email protected]>
Cc David Woodhouse <[email protected]>
Cc Don Dutile <[email protected]>
Cc Thomas Gleixner <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc "H. Peter Anvin" <[email protected]>
Cc Andi Kleen <andi-Vw/[email protected]>
Cc Yinghai Lu <[email protected]>
Cc iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org
Quoted 27 lines

---
* v2
- Add information in help text, suggested by Chuck Ebbert

  drivers/base/Kconfig | 8 +++++++-
  1 file changed, 7 insertions(+), 1 deletion(-)
drivers/base/Kconfig +4 -1
index 4e7f0ff..115882f 100644
@@ -240,18 +240,24 @@ comment "Default contiguous memory area size:"
  config CMA_SIZE_MBYTES
  	int "Size in Mega Bytes"
  	depends on !CMA_SIZE_SEL_PERCENTAGE
+	default 0 if X86
  	default 16
  	help
  	  Defines the size (in MiB) of the default memory area for Contiguous
-	  Memory Allocator.
+	  Memory Allocator.  If the size of 0 is selected, CMA is disabled by
+	  default, but it can be enabled by passing cma=size[MG] to the kernel.
+
 
  config CMA_SIZE_PERCENTAGE
  	int "Percentage of total memory"
  	depends on !CMA_SIZE_SEL_MBYTES

drivers/base/Kconfig comment "Default contiguous memory area size:" · line 263

Quoted 10 lines
drivers/base/Kconfig +3 -0
+	default 0 if X86
  	default 10
  	help
  	  Defines the size of the default memory area for Contiguous Memory
  	  Allocator as a percentage of the total memory in the system.
+	  If 0 percent is selected, CMA is disabled by default, but it can be
+	  enabled by passing cma=size[MG] to the kernel.
 
  choice
  	prompt "Selected region size"

Best regards

Signature · 2 lines
Marek Szyprowski, PhD
Samsung R&D Institute Poland