cma: make default CMA area size zero for x86
Subsystems (2)
PATCH 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.
--- drivers/base/Kconfig | 2 ++ 1 file changed, 2 insertions(+)
drivers/base/Kconfig +2 -0
@@ -240,6 +240,7 @@ 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
@@ -248,6 +249,7 @@ config CMA_SIZE_MBYTES 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
Signature · 1 line
1.9.1
Quoted 42 lines · On Sun, 5 Oct 2014 15:02:56 +0900 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_CMAis 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.
Signed-off-by Akinobu Mita <[email protected]>Reported-by Peter Hurley <[email protected]>Cc Peter Hurley <[email protected]>Cc Chuck Ebbert <[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--- drivers/base/Kconfig | 2 ++ 1 file changed, 2 insertions(+)drivers/base/Kconfig +1
-0@@ -240,6 +240,7 @@ 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
drivers/base/Kconfig config CMA_SIZE_MBYTES · line 255
Quoted 7 lines
drivers/base/Kconfig +1
-0@@ -248,6 +249,7 @@ config CMA_SIZE_MBYTES 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
You probably need to add some documentation too. Jean Delvare proposed the below, before your change. If the default is going to be zero on x86, that information and some further help should be added to this.
------------------------
From: Jean Delvare <[email protected]>
Subject: [PATCH] CMA: Document cma=0
It isn't obvious that CMA can be disabled on the kernel's command line, so document it.
--- Documentation/kernel-parameters.txt | 3 ++- drivers/base/Kconfig | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-)
Documentation/kernel-parameters.txt +2 -1
@@ -656,7 +656,8 @@ bytes respectively. Such letter suffixes Sets the size of kernel global memory area for contiguous memory allocations and optionally the placement constraint by the physical address range of - memory allocations. For more information, see + memory allocations. A value of 0 disables CMA + altogether. For more information, see include/linux/dma-contiguous.h cmo_free_hint= [PPC] Format: { yes | no }
drivers/base/Kconfig +3 -0
@@ -231,6 +231,9 @@ config DMA_CMA to allocate big physically-contiguous blocks of memory for use with hardware components that do not support I/O map nor scatter-gather. + You can disable CMA by specifying "cma=0" on the kernel's command + line. + For more information see <include/linux/dma-contiguous.h>. If unsure, say "n".
2014-10-05 19:47 GMT+09:00 Chuck Ebbert <[email protected]>:
Quoted 48 lines
Quoted 45 lines · On Sun, 5 Oct 2014 15:02:56 +0900 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_CMAis 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.
Signed-off-by Akinobu Mita <[email protected]>Reported-by Peter Hurley <[email protected]>Cc Peter Hurley <[email protected]>Cc Chuck Ebbert <[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--- drivers/base/Kconfig | 2 ++ 1 file changed, 2 insertions(+)drivers/base/Kconfig +1
-0@@ -240,6 +240,7 @@ 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@@ -248,6 +249,7 @@ config CMA_SIZE_MBYTES config CMA_SIZE_PERCENTAGE int "Percentage of total memory" depends on !CMA_SIZE_SEL_MBYTES
Quoted 8 lines
drivers/base/Kconfig config CMA_SIZE_MBYTES · line 255
Quoted 4 lines
drivers/base/Kconfig +1
-0+ default 0 if X86 default 10 help Defines the size of the default memory area for Contiguous MemoryYou probably need to add some documentation too. Jean Delvare proposed the below, before your change. If the default is going to be zero on x86, that information and some further help should be added to this.
OK, I'll add information in help text for CONFIG_CMA_SIZE_MBYTES and CONFIG_CMA_SIZE_PERCENTAGE.
Jean's patch adds information in CONFIG_DMA_CMA, so this change doesn't conflict his patch.
Quoted 40 lines
------------------------
From: Jean Delvare <[email protected]>
Subject: [PATCH] CMA: Document cma=0It isn't obvious that CMA can be disabled on the kernel's command line, so document it.
Signed-off-by Jean Delvare <[email protected]>Cc Joonsoo Kim <[email protected]>Cc Greg Kroah-Hartman <[email protected]>--- Documentation/kernel-parameters.txt | 3 ++- drivers/base/Kconfig | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-)Documentation/kernel-parameters.txt 2014-10-04 14:10:03.257579721 +0200 renamed from Documentation/kernel-parameters.txt 2014-09-23 13:19:06.644838292 +0200 +2
-1@@ -656,7 +656,8 @@ bytes respectively. Such letter suffixes Sets the size of kernel global memory area for contiguous memory allocations and optionally the placement constraint by the physical address range of - memory allocations. For more information, see + memory allocations. A value of 0 disables CMA + altogether. For more information, see include/linux/dma-contiguous.h cmo_free_hint= [PPC] Format: { yes | no }drivers/base/Kconfig 2014-10-04 13:41:37.672347240 +0200 renamed from drivers/base/Kconfig 2014-09-12 16:23:14.911353676 +0200 +3
-0@@ -231,6 +231,9 @@ config DMA_CMA to allocate big physically-contiguous blocks of memory for use with hardware components that do not support I/O map nor scatter-gather. + You can disable CMA by specifying "cma=0" on the kernel's command + line. + For more information see <include/linux/dma-contiguous.h>. If unsure, say "n".