All of lore.kernel.org
 help / color / mirror / Atom feed
* [patch v2] x86: allow ZONE_DMA to be configurable
@ 2011-04-14 18:38 David Rientjes
  2011-04-15 11:42 ` Clemens Ladisch
  0 siblings, 1 reply; 12+ messages in thread
From: David Rientjes @ 2011-04-14 18:38 UTC (permalink / raw)
  To: Ingo Molnar, H. Peter Anvin, Thomas Gleixner; +Cc: x86, linux-kernel

ZONE_DMA is unnecessary for a large number of machines that do not
require addressing in the lower 16MB of memory because they do not use
ISA devices with 16-bit address registers (plus one page byte register).

This patch allows users to disable ZONE_DMA for x86 if they know they
will not be using such devices with their kernel.

This prevents the VM from unnecessarily reserving a ratio of memory
(defaulting to 1/256th of system capacity) with lowmem_reserve_ratio
for such allocations when it will never be used.

Signed-off-by: David Rientjes <rientjes@google.com>
---
 v2: updated from October 2010

     H. Peter Anvin requested that CONFIG_EMBEDDED be renamed to
     CONFIG_EXPERT prior to this change in the original thread:

	http://marc.info/?t=128701541500005

     I did that at Ingo's suggestion.  Also, CONFIG_GENERIC_ISA_DMA
     and CONFIG_ISA_DMA_API are now configurable on x86 as discussed
     in the same thread, as well, for additional text savings in
     combination with this patch.

 arch/x86/Kconfig      |    9 ++++++++-
 arch/x86/mm/init_32.c |    2 ++
 arch/x86/mm/init_64.c |    2 ++
 3 files changed, 12 insertions(+), 1 deletions(-)

diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -112,7 +112,14 @@ config MMU
 	def_bool y
 
 config ZONE_DMA
-	def_bool y
+	bool "DMA memory allocation support" if EXPERT
+	default y
+	help
+	  DMA memory allocation support allows old ISA devices with 16-bit
+	  address registers to allocate memory within the first 16MB of
+	  address space.  Disable if no such devices will be used.
+
+	  If unsure, say Y.
 
 config SBUS
 	bool
diff --git a/arch/x86/mm/init_32.c b/arch/x86/mm/init_32.c
--- a/arch/x86/mm/init_32.c
+++ b/arch/x86/mm/init_32.c
@@ -678,8 +678,10 @@ static void __init zone_sizes_init(void)
 {
 	unsigned long max_zone_pfns[MAX_NR_ZONES];
 	memset(max_zone_pfns, 0, sizeof(max_zone_pfns));
+#ifdef CONFIG_ZONE_DMA
 	max_zone_pfns[ZONE_DMA] =
 		virt_to_phys((char *)MAX_DMA_ADDRESS) >> PAGE_SHIFT;
+#endif
 	max_zone_pfns[ZONE_NORMAL] = max_low_pfn;
 #ifdef CONFIG_HIGHMEM
 	max_zone_pfns[ZONE_HIGHMEM] = highend_pfn;
diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c
--- a/arch/x86/mm/init_64.c
+++ b/arch/x86/mm/init_64.c
@@ -616,7 +616,9 @@ void __init paging_init(void)
 	unsigned long max_zone_pfns[MAX_NR_ZONES];
 
 	memset(max_zone_pfns, 0, sizeof(max_zone_pfns));
+#ifdef CONFIG_ZONE_DMA
 	max_zone_pfns[ZONE_DMA] = MAX_DMA_PFN;
+#endif
 	max_zone_pfns[ZONE_DMA32] = MAX_DMA32_PFN;
 	max_zone_pfns[ZONE_NORMAL] = max_pfn;
 

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [patch v2] x86: allow ZONE_DMA to be configurable
  2011-04-14 18:38 [patch v2] x86: allow ZONE_DMA to be configurable David Rientjes
@ 2011-04-15 11:42 ` Clemens Ladisch
  2011-04-15 20:08   ` H. Peter Anvin
  0 siblings, 1 reply; 12+ messages in thread
From: Clemens Ladisch @ 2011-04-15 11:42 UTC (permalink / raw)
  To: David Rientjes
  Cc: Ingo Molnar, H. Peter Anvin, Thomas Gleixner, x86, linux-kernel

David Rientjes wrote:
> ZONE_DMA is unnecessary for a large number of machines that do not
> require addressing in the lower 16MB of memory because they do not use
> ISA devices with 16-bit address registers (plus one page byte register).
> 
> This patch allows users to disable ZONE_DMA for x86 if they know they
> will not be using such devices with their kernel.
> ...
>  config ZONE_DMA
> -	def_bool y
> +	bool "DMA memory allocation support" if EXPERT

Better call it "ISA/LPC DMA memory allocation support".

> +	default y

Does it make sense to have this without CONFIG_ISA_DMA_API?

> +	help
> +	  DMA memory allocation support allows old ISA devices with 16-bit
> +	  address registers to allocate memory within the first 16MB of
> +	  address space.  Disable if no such devices will be used.

"Old ISA devices" might be misleading because ISA does not imply actual
ISA slots; please mention LPC devices like the floppy controller and the
parallel port in ECP mode.


Regards,
Clemens

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [patch v2] x86: allow ZONE_DMA to be configurable
  2011-04-15 11:42 ` Clemens Ladisch
@ 2011-04-15 20:08   ` H. Peter Anvin
  2011-04-21  2:31     ` David Rientjes
  0 siblings, 1 reply; 12+ messages in thread
From: H. Peter Anvin @ 2011-04-15 20:08 UTC (permalink / raw)
  To: Clemens Ladisch
  Cc: David Rientjes, Ingo Molnar, Thomas Gleixner, x86, linux-kernel

On 04/15/2011 04:42 AM, Clemens Ladisch wrote:
> David Rientjes wrote:
>> ZONE_DMA is unnecessary for a large number of machines that do not
>> require addressing in the lower 16MB of memory because they do not use
>> ISA devices with 16-bit address registers (plus one page byte register).
>>
>> This patch allows users to disable ZONE_DMA for x86 if they know they
>> will not be using such devices with their kernel.
>> ...
>>  config ZONE_DMA
>> -	def_bool y
>> +	bool "DMA memory allocation support" if EXPERT
> 
> Better call it "ISA/LPC DMA memory allocation support".
> 
>> +	default y
> 
> Does it make sense to have this without CONFIG_ISA_DMA_API?
> 
>> +	help
>> +	  DMA memory allocation support allows old ISA devices with 16-bit
>> +	  address registers to allocate memory within the first 16MB of
>> +	  address space.  Disable if no such devices will be used.
> 
> "Old ISA devices" might be misleading because ISA does not imply actual
> ISA slots; please mention LPC devices like the floppy controller and the
> parallel port in ECP mode.
> 

This isn't really a very good edit, as ZONE_DMA isn't inherently limited
to ISA/LPC devices (and LPC devices which do LPC-native bus mastering
DMA are not affected.)  ZONE_DMA is used even for some PCI devices which
have restrictions on the DMA address mask.

	-hpa



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [patch v2] x86: allow ZONE_DMA to be configurable
  2011-04-15 20:08   ` H. Peter Anvin
@ 2011-04-21  2:31     ` David Rientjes
  2011-04-21  4:07       ` H. Peter Anvin
  0 siblings, 1 reply; 12+ messages in thread
From: David Rientjes @ 2011-04-21  2:31 UTC (permalink / raw)
  To: H. Peter Anvin
  Cc: Clemens Ladisch, Ingo Molnar, Thomas Gleixner, x86, linux-kernel

On Fri, 15 Apr 2011, H. Peter Anvin wrote:

> On 04/15/2011 04:42 AM, Clemens Ladisch wrote:
> > David Rientjes wrote:
> >> ZONE_DMA is unnecessary for a large number of machines that do not
> >> require addressing in the lower 16MB of memory because they do not use
> >> ISA devices with 16-bit address registers (plus one page byte register).
> >>
> >> This patch allows users to disable ZONE_DMA for x86 if they know they
> >> will not be using such devices with their kernel.
> >> ...
> >>  config ZONE_DMA
> >> -	def_bool y
> >> +	bool "DMA memory allocation support" if EXPERT
> > 
> > Better call it "ISA/LPC DMA memory allocation support".
> > 
> >> +	default y
> > 
> > Does it make sense to have this without CONFIG_ISA_DMA_API?
> > 
> >> +	help
> >> +	  DMA memory allocation support allows old ISA devices with 16-bit
> >> +	  address registers to allocate memory within the first 16MB of
> >> +	  address space.  Disable if no such devices will be used.
> > 
> > "Old ISA devices" might be misleading because ISA does not imply actual
> > ISA slots; please mention LPC devices like the floppy controller and the
> > parallel port in ECP mode.
> > 
> 
> This isn't really a very good edit, as ZONE_DMA isn't inherently limited
> to ISA/LPC devices (and LPC devices which do LPC-native bus mastering
> DMA are not affected.)  ZONE_DMA is used even for some PCI devices which
> have restrictions on the DMA address mask.
> 

Peter, do you think we can merge this patch now?  The discussion from 
October resulted in the decision to rename CONFIG_EMBEDDED to 
CONFIG_EXPERT and make CONFIG_GENERIC_ISA_DMA and CONFIG_ISA_DMA_API 
configurable for x86.  That's all been done via the -mm tree and is in the 
latest git.

We've run without ZONE_DMA for a few years without issues (and, obviously, 
this patch) on x86.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [patch v2] x86: allow ZONE_DMA to be configurable
  2011-04-21  2:31     ` David Rientjes
@ 2011-04-21  4:07       ` H. Peter Anvin
  2011-04-27 23:37         ` [patch v3] " David Rientjes
  0 siblings, 1 reply; 12+ messages in thread
From: H. Peter Anvin @ 2011-04-21  4:07 UTC (permalink / raw)
  To: David Rientjes
  Cc: Clemens Ladisch, Ingo Molnar, Thomas Gleixner, x86, linux-kernel

On 04/20/2011 07:31 PM, David Rientjes wrote:
>>
>> This isn't really a very good edit, as ZONE_DMA isn't inherently limited
>> to ISA/LPC devices (and LPC devices which do LPC-native bus mastering
>> DMA are not affected.)  ZONE_DMA is used even for some PCI devices which
>> have restrictions on the DMA address mask.
>>
> 
> Peter, do you think we can merge this patch now?  The discussion from 
> October resulted in the decision to rename CONFIG_EMBEDDED to 
> CONFIG_EXPERT and make CONFIG_GENERIC_ISA_DMA and CONFIG_ISA_DMA_API 
> configurable for x86.  That's all been done via the -mm tree and is in the 
> latest git.
> 
> We've run without ZONE_DMA for a few years without issues (and, obviously, 
> this patch) on x86.

Please address the documentation issues.  ZONE_DMA is *NOT* just for
"old ISA devices" -- there are plenty of other devices with restricted
DMA masks.

	-hpa

-- 
H. Peter Anvin, Intel Open Source Technology Center
I work for Intel.  I don't speak on their behalf.


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [patch v3] x86: allow ZONE_DMA to be configurable
  2011-04-21  4:07       ` H. Peter Anvin
@ 2011-04-27 23:37         ` David Rientjes
  2011-05-04  0:00           ` David Rientjes
  2011-05-16 20:54           ` [patch v4] " David Rientjes
  0 siblings, 2 replies; 12+ messages in thread
From: David Rientjes @ 2011-04-27 23:37 UTC (permalink / raw)
  To: H. Peter Anvin; +Cc: Ingo Molnar, Thomas Gleixner, x86, linux-kernel

ZONE_DMA is unnecessary for a large number of machines that do not
require addressing in the lower 16MB of memory because they do not use
devices with 16-bit address registers (plus one page byte register).

This patch allows users to disable ZONE_DMA for x86 if they know they
will not be using such devices with their kernel.

This prevents the VM from unnecessarily reserving a ratio of memory
(defaulting to 1/256th of system capacity) with lowmem_reserve_ratio
for such allocations when it will never be used.

Signed-off-by: David Rientjes <rientjes@google.com>
---
 v3: did s/old ISA devices/devices/ as suggested by H. Peter Anvin.

 arch/x86/Kconfig      |    9 ++++++++-
 arch/x86/mm/init_32.c |    2 ++
 arch/x86/mm/init_64.c |    2 ++
 3 files changed, 12 insertions(+), 1 deletions(-)

diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -112,7 +112,14 @@ config MMU
 	def_bool y
 
 config ZONE_DMA
-	def_bool y
+	bool "DMA memory allocation support" if EXPERT
+	default y
+	help
+	  DMA memory allocation support allows devices with 16-bit address
+	  registers to allocate memory within the first 16MB of address space.
+	  Disable if no such devices will be used.
+
+	  If unsure, say Y.
 
 config SBUS
 	bool
diff --git a/arch/x86/mm/init_32.c b/arch/x86/mm/init_32.c
--- a/arch/x86/mm/init_32.c
+++ b/arch/x86/mm/init_32.c
@@ -678,8 +678,10 @@ static void __init zone_sizes_init(void)
 {
 	unsigned long max_zone_pfns[MAX_NR_ZONES];
 	memset(max_zone_pfns, 0, sizeof(max_zone_pfns));
+#ifdef CONFIG_ZONE_DMA
 	max_zone_pfns[ZONE_DMA] =
 		virt_to_phys((char *)MAX_DMA_ADDRESS) >> PAGE_SHIFT;
+#endif
 	max_zone_pfns[ZONE_NORMAL] = max_low_pfn;
 #ifdef CONFIG_HIGHMEM
 	max_zone_pfns[ZONE_HIGHMEM] = highend_pfn;
diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c
--- a/arch/x86/mm/init_64.c
+++ b/arch/x86/mm/init_64.c
@@ -616,7 +616,9 @@ void __init paging_init(void)
 	unsigned long max_zone_pfns[MAX_NR_ZONES];
 
 	memset(max_zone_pfns, 0, sizeof(max_zone_pfns));
+#ifdef CONFIG_ZONE_DMA
 	max_zone_pfns[ZONE_DMA] = MAX_DMA_PFN;
+#endif
 	max_zone_pfns[ZONE_DMA32] = MAX_DMA32_PFN;
 	max_zone_pfns[ZONE_NORMAL] = max_pfn;
 

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [patch v3] x86: allow ZONE_DMA to be configurable
  2011-04-27 23:37         ` [patch v3] " David Rientjes
@ 2011-05-04  0:00           ` David Rientjes
  2011-05-04  0:20             ` H. Peter Anvin
  2011-05-16 20:54           ` [patch v4] " David Rientjes
  1 sibling, 1 reply; 12+ messages in thread
From: David Rientjes @ 2011-05-04  0:00 UTC (permalink / raw)
  To: H. Peter Anvin; +Cc: Ingo Molnar, Thomas Gleixner, x86, linux-kernel

On Wed, 27 Apr 2011, David Rientjes wrote:

> ZONE_DMA is unnecessary for a large number of machines that do not
> require addressing in the lower 16MB of memory because they do not use
> devices with 16-bit address registers (plus one page byte register).
> 
> This patch allows users to disable ZONE_DMA for x86 if they know they
> will not be using such devices with their kernel.
> 
> This prevents the VM from unnecessarily reserving a ratio of memory
> (defaulting to 1/256th of system capacity) with lowmem_reserve_ratio
> for such allocations when it will never be used.
> 
> Signed-off-by: David Rientjes <rientjes@google.com>

Peter, is this ready for merge?

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [patch v3] x86: allow ZONE_DMA to be configurable
  2011-05-04  0:00           ` David Rientjes
@ 2011-05-04  0:20             ` H. Peter Anvin
  0 siblings, 0 replies; 12+ messages in thread
From: H. Peter Anvin @ 2011-05-04  0:20 UTC (permalink / raw)
  To: David Rientjes; +Cc: Ingo Molnar, Thomas Gleixner, x86, linux-kernel

On 05/03/2011 05:00 PM, David Rientjes wrote:
> On Wed, 27 Apr 2011, David Rientjes wrote:
> 
>> ZONE_DMA is unnecessary for a large number of machines that do not
>> require addressing in the lower 16MB of memory because they do not use
>> devices with 16-bit address registers (plus one page byte register).
>>
>> This patch allows users to disable ZONE_DMA for x86 if they know they
>> will not be using such devices with their kernel.
>>
>> This prevents the VM from unnecessarily reserving a ratio of memory
>> (defaulting to 1/256th of system capacity) with lowmem_reserve_ratio
>> for such allocations when it will never be used.
>>
>> Signed-off-by: David Rientjes <rientjes@google.com>
> 
> Peter, is this ready for merge?


+ DMA memory allocation support allows devices with 16-bit address
+ registers to allocate memory within the first 16MB of address space.
+ Disable if no such devices will be used.

This is still not correct... this is for devices with less than a 32-bit
mask, not just for things that have 24-bit (not 16-bit!) DMA address
restrictions.

Please get this right.

Other than that, I don't have any technical objections.

	-hpa

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [patch v4] x86: allow ZONE_DMA to be configurable
  2011-04-27 23:37         ` [patch v3] " David Rientjes
  2011-05-04  0:00           ` David Rientjes
@ 2011-05-16 20:54           ` David Rientjes
  2011-05-16 20:56             ` H. Peter Anvin
  2011-05-16 23:13             ` [tip:x86/mm] x86, mm: Allow " tip-bot for David Rientjes
  1 sibling, 2 replies; 12+ messages in thread
From: David Rientjes @ 2011-05-16 20:54 UTC (permalink / raw)
  To: H. Peter Anvin; +Cc: Ingo Molnar, Thomas Gleixner, x86, linux-kernel

ZONE_DMA is unnecessary for a large number of machines that do not
require addressing in the lower 16MB of memory because they do not use
devices with 16-bit address registers (plus one page byte register).

This patch allows users to disable ZONE_DMA for x86 if they know they
will not be using such devices with their kernel.

This prevents the VM from unnecessarily reserving a ratio of memory
(defaulting to 1/256th of system capacity) with lowmem_reserve_ratio
for such allocations when it will never be used.

Signed-off-by: David Rientjes <rientjes@google.com>
---
 arch/x86/Kconfig      |    9 ++++++++-
 arch/x86/mm/init_32.c |    2 ++
 arch/x86/mm/init_64.c |    2 ++
 3 files changed, 12 insertions(+), 1 deletions(-)

diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -112,7 +112,14 @@ config MMU
 	def_bool y
 
 config ZONE_DMA
-	def_bool y
+	bool "DMA memory allocation support" if EXPERT
+	default y
+	help
+	  DMA memory allocation support allows devices with less than 32-bit
+	  addressing to allocate within the first 16MB of address space.
+	  Disable if no such devices will be used.
+
+	  If unsure, say Y.
 
 config SBUS
 	bool
diff --git a/arch/x86/mm/init_32.c b/arch/x86/mm/init_32.c
--- a/arch/x86/mm/init_32.c
+++ b/arch/x86/mm/init_32.c
@@ -678,8 +678,10 @@ static void __init zone_sizes_init(void)
 {
 	unsigned long max_zone_pfns[MAX_NR_ZONES];
 	memset(max_zone_pfns, 0, sizeof(max_zone_pfns));
+#ifdef CONFIG_ZONE_DMA
 	max_zone_pfns[ZONE_DMA] =
 		virt_to_phys((char *)MAX_DMA_ADDRESS) >> PAGE_SHIFT;
+#endif
 	max_zone_pfns[ZONE_NORMAL] = max_low_pfn;
 #ifdef CONFIG_HIGHMEM
 	max_zone_pfns[ZONE_HIGHMEM] = highend_pfn;
diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c
--- a/arch/x86/mm/init_64.c
+++ b/arch/x86/mm/init_64.c
@@ -616,7 +616,9 @@ void __init paging_init(void)
 	unsigned long max_zone_pfns[MAX_NR_ZONES];
 
 	memset(max_zone_pfns, 0, sizeof(max_zone_pfns));
+#ifdef CONFIG_ZONE_DMA
 	max_zone_pfns[ZONE_DMA] = MAX_DMA_PFN;
+#endif
 	max_zone_pfns[ZONE_DMA32] = MAX_DMA32_PFN;
 	max_zone_pfns[ZONE_NORMAL] = max_pfn;
 

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [patch v4] x86: allow ZONE_DMA to be configurable
  2011-05-16 20:54           ` [patch v4] " David Rientjes
@ 2011-05-16 20:56             ` H. Peter Anvin
  2011-05-16 23:13             ` [tip:x86/mm] x86, mm: Allow " tip-bot for David Rientjes
  1 sibling, 0 replies; 12+ messages in thread
From: H. Peter Anvin @ 2011-05-16 20:56 UTC (permalink / raw)
  To: David Rientjes; +Cc: Ingo Molnar, Thomas Gleixner, x86, linux-kernel

On 05/16/2011 01:54 PM, David Rientjes wrote:
> ZONE_DMA is unnecessary for a large number of machines that do not
> require addressing in the lower 16MB of memory because they do not use
> devices with 16-bit address registers (plus one page byte register).

You keep repeating this error, although this time you at least fixed the
Kconfig file.  I'll fix up the checkin message and apply.

	-hpa

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [tip:x86/mm] x86, mm: Allow ZONE_DMA to be configurable
  2011-05-16 20:54           ` [patch v4] " David Rientjes
  2011-05-16 20:56             ` H. Peter Anvin
@ 2011-05-16 23:13             ` tip-bot for David Rientjes
  2011-08-17 10:37               ` Borislav Petkov
  1 sibling, 1 reply; 12+ messages in thread
From: tip-bot for David Rientjes @ 2011-05-16 23:13 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, tglx, hpa, rientjes

Commit-ID:  dc382fd5bcca7098a984705ed6ac880f539d068e
Gitweb:     http://git.kernel.org/tip/dc382fd5bcca7098a984705ed6ac880f539d068e
Author:     David Rientjes <rientjes@google.com>
AuthorDate: Mon, 16 May 2011 13:54:10 -0700
Committer:  H. Peter Anvin <hpa@linux.intel.com>
CommitDate: Mon, 16 May 2011 14:03:28 -0700

x86, mm: Allow ZONE_DMA to be configurable

ZONE_DMA is unnecessary for a large number of machines that do not
require less than 32-bit DMA addressing, e.g. ISA legacy DMA or PCI
cards with a restricted DMA address mask.

This patch allows users to disable ZONE_DMA for x86 if they know they
will not be using such devices with their kernel.

This prevents the VM from unnecessarily reserving a ratio of memory
(defaulting to 1/256th of system capacity) with lowmem_reserve_ratio
for such allocations when it will never be used.

Signed-off-by: David Rientjes <rientjes@google.com>
Link: http://lkml.kernel.org/r/alpine.DEB.2.00.1105161353560.4353@chino.kir.corp.google.com
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
---
 arch/x86/Kconfig      |    9 ++++++++-
 arch/x86/mm/init_32.c |    2 ++
 arch/x86/mm/init_64.c |    2 ++
 3 files changed, 12 insertions(+), 1 deletions(-)

diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 648fca4..0eb801a 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -112,7 +112,14 @@ config MMU
 	def_bool y
 
 config ZONE_DMA
-	def_bool y
+	bool "DMA memory allocation support" if EXPERT
+	default y
+	help
+	  DMA memory allocation support allows devices with less than 32-bit
+	  addressing to allocate within the first 16MB of address space.
+	  Disable if no such devices will be used.
+
+	  If unsure, say Y.
 
 config SBUS
 	bool
diff --git a/arch/x86/mm/init_32.c b/arch/x86/mm/init_32.c
index 2cde0a34..29f7c6d 100644
--- a/arch/x86/mm/init_32.c
+++ b/arch/x86/mm/init_32.c
@@ -678,8 +678,10 @@ static void __init zone_sizes_init(void)
 {
 	unsigned long max_zone_pfns[MAX_NR_ZONES];
 	memset(max_zone_pfns, 0, sizeof(max_zone_pfns));
+#ifdef CONFIG_ZONE_DMA
 	max_zone_pfns[ZONE_DMA] =
 		virt_to_phys((char *)MAX_DMA_ADDRESS) >> PAGE_SHIFT;
+#endif
 	max_zone_pfns[ZONE_NORMAL] = max_low_pfn;
 #ifdef CONFIG_HIGHMEM
 	max_zone_pfns[ZONE_HIGHMEM] = highend_pfn;
diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c
index 0404bb3..d865c4a 100644
--- a/arch/x86/mm/init_64.c
+++ b/arch/x86/mm/init_64.c
@@ -616,7 +616,9 @@ void __init paging_init(void)
 	unsigned long max_zone_pfns[MAX_NR_ZONES];
 
 	memset(max_zone_pfns, 0, sizeof(max_zone_pfns));
+#ifdef CONFIG_ZONE_DMA
 	max_zone_pfns[ZONE_DMA] = MAX_DMA_PFN;
+#endif
 	max_zone_pfns[ZONE_DMA32] = MAX_DMA32_PFN;
 	max_zone_pfns[ZONE_NORMAL] = max_pfn;
 

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [tip:x86/mm] x86, mm: Allow ZONE_DMA to be configurable
  2011-05-16 23:13             ` [tip:x86/mm] x86, mm: Allow " tip-bot for David Rientjes
@ 2011-08-17 10:37               ` Borislav Petkov
  0 siblings, 0 replies; 12+ messages in thread
From: Borislav Petkov @ 2011-08-17 10:37 UTC (permalink / raw)
  To: mingo, hpa, linux-kernel, tglx, rientjes, hpa; +Cc: linux-tip-commits

On Mon, May 16, 2011 at 11:13:07PM +0000, tip-bot for David Rientjes wrote:
> Commit-ID:  dc382fd5bcca7098a984705ed6ac880f539d068e
> Gitweb:     http://git.kernel.org/tip/dc382fd5bcca7098a984705ed6ac880f539d068e
> Author:     David Rientjes <rientjes@google.com>
> AuthorDate: Mon, 16 May 2011 13:54:10 -0700
> Committer:  H. Peter Anvin <hpa@linux.intel.com>
> CommitDate: Mon, 16 May 2011 14:03:28 -0700
> 
> x86, mm: Allow ZONE_DMA to be configurable
> 
> ZONE_DMA is unnecessary for a large number of machines that do not
> require less than 32-bit DMA addressing, e.g. ISA legacy DMA or PCI
> cards with a restricted DMA address mask.
> 
> This patch allows users to disable ZONE_DMA for x86 if they know they
> will not be using such devices with their kernel.
> 
> This prevents the VM from unnecessarily reserving a ratio of memory
> (defaulting to 1/256th of system capacity) with lowmem_reserve_ratio
> for such allocations when it will never be used.
> 
> Signed-off-by: David Rientjes <rientjes@google.com>
> Link: http://lkml.kernel.org/r/alpine.DEB.2.00.1105161353560.4353@chino.kir.corp.google.com
> Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>

This causes the ZONE_DMA menu option to appear in the toplevel menu of
the kernel configurator instead of under EXPERT, where it should belong
IMO.

> ---
>  arch/x86/Kconfig      |    9 ++++++++-
>  arch/x86/mm/init_32.c |    2 ++
>  arch/x86/mm/init_64.c |    2 ++
>  3 files changed, 12 insertions(+), 1 deletions(-)
> 
> diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
> index 648fca4..0eb801a 100644
> --- a/arch/x86/Kconfig
> +++ b/arch/x86/Kconfig
> @@ -112,7 +112,14 @@ config MMU
>  	def_bool y
>  
>  config ZONE_DMA
> -	def_bool y
> +	bool "DMA memory allocation support" if EXPERT
> +	default y
> +	help
> +	  DMA memory allocation support allows devices with less than 32-bit
> +	  addressing to allocate within the first 16MB of address space.
> +	  Disable if no such devices will be used.
> +
> +	  If unsure, say Y.

maybe this should go into init/Kconfig ?

Thanks.

-- 
Regards/Gruss,
    Boris.

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2011-08-17 10:37 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-04-14 18:38 [patch v2] x86: allow ZONE_DMA to be configurable David Rientjes
2011-04-15 11:42 ` Clemens Ladisch
2011-04-15 20:08   ` H. Peter Anvin
2011-04-21  2:31     ` David Rientjes
2011-04-21  4:07       ` H. Peter Anvin
2011-04-27 23:37         ` [patch v3] " David Rientjes
2011-05-04  0:00           ` David Rientjes
2011-05-04  0:20             ` H. Peter Anvin
2011-05-16 20:54           ` [patch v4] " David Rientjes
2011-05-16 20:56             ` H. Peter Anvin
2011-05-16 23:13             ` [tip:x86/mm] x86, mm: Allow " tip-bot for David Rientjes
2011-08-17 10:37               ` Borislav Petkov

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.