Skip to contentSkip to conversation

introduce config option to disable DMA zone on i386

PATCH In review Marcelo Tosatti 4 participants 4 messages Dec 28, 2006 Memory management

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 introduce config option to disable DMA zone on i386

Hi,

The following patch adds a config option to get rid of the DMA zone on i386.

Architectures with devices that have no addressing limitations (eg. PPC) already work this way.

This is useful for custom kernel builds where the developer is certain that there are no address limitations.

For example, the OLPC machine contains:

- USB devices
- no floppy
- no address limited PCI devices
- no floppy

A unified zone simplifies VM reclaiming work, and also simplifies OOM killer heuristics (no need to deal with OOM on the DMA zone).

Comments?

arch/i386/Kconfig +12 -0
index 0d67a0a..8d4dd5e 100644
@@ -547,6 +547,18 @@ choice
 		bool "1G/3G user/kernel split"
 endchoice
 
+config NO_DMA_ZONE
+	bool "DMA zone support"
+	default n
+	help
+	 This disables support for the 16MiB DMA zone. Only enable this 
+	 option if you are certain that your devices contain no DMA
+	 addressing limitations. A few of them which do: 
+	 	- floppy
+	 	- ISA devices
+	 	- some PCI devices (soundcards, etc)
+
+
 config PAGE_OFFSET
 	hex
 	default 0xB0000000 if VMSPLIT_3G_OPT
arch/i386/kernel/setup.c +4 -0
index 79df6e6..3078019 100644
@@ -371,9 +371,13 @@ void __init zone_sizes_init(void)
 {
 	unsigned long max_zone_pfns[MAX_NR_ZONES];
 	memset(max_zone_pfns, 0, sizeof(max_zone_pfns));
+#ifndef CONFIG_NO_DMA_ZONE
 	max_zone_pfns[ZONE_DMA] =
 		virt_to_phys((char *)MAX_DMA_ADDRESS) >> PAGE_SHIFT;
 	max_zone_pfns[ZONE_NORMAL] = max_low_pfn;
+#else
+	max_zone_pfns[ZONE_DMA] = max_low_pfn;
+#endif
 #ifdef CONFIG_HIGHMEM
 	max_zone_pfns[ZONE_HIGHMEM] = highend_pfn;
 	add_active_range(0, 0, highend_pfn);

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#1 lore raw
Quoted 8 lines · Marcelo Tosatti

The following patch adds a config option to get rid of the DMA zone on i386.

Architectures with devices that have no addressing limitations (eg. PPC) already work this way.

This is useful for custom kernel builds where the developer is certain that there are no address limitations.

Don't know if you're aware or not, but there's already a CONFIG_ZONE_DMA in -mm that accomplishes this, which goes a bit further in that it rips out all of the generic ZONE_DMA references. Quite a few architectures that have no interest in the zone are using this already.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#2 lore raw
In reply to Marcelo Tosatti
Quoted 17 lines · Marcelo Tosatti

Hi,

The following patch adds a config option to get rid of the DMA zone on i386.

Architectures with devices that have no addressing limitations (eg. PPC) already work this way.

This is useful for custom kernel builds where the developer is certain that there are no address limitations.

For example, the OLPC machine contains:

- USB devices
- no floppy
- no address limited PCI devices
- no floppy

Quoted 4 lines

A unified zone simplifies VM reclaiming work, and also simplifies OOM killer heuristics (no need to deal with OOM on the DMA zone).

Comments?

Hi,

since one gets random corruption if a user gets this wrong, at least make things like floppy and all CONFIG_ISA stuff conflict with this option.... without that your patch feels like a walking time bomb... (and please include all PCI drivers that only can do 24 bit or 28bit or .. non-32bit dma as well)

Greetings,
Arjan van de Ven

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#3 lore raw
In reply to Marcelo Tosatti
Quoted 4 lines · Marcelo Tosatti

Comments?

+config NO_DMA_ZONE

         ^^^^^^

arch/i386/Kconfig choice · line 551

Quoted 1 line
arch/i386/Kconfig +1 -0
+	bool "DMA zone support"
              ^^^

arch/i386/Kconfig choice · line 552

Quoted 1 line
arch/i386/Kconfig +1 -0
+	default n
                ^

arch/i386/Kconfig choice

Quoted 4 lines
arch/i386/Kconfig +4 -0
+	help
+	 This disables support for the 16MiB DMA zone. Only enable this 
+	 option if you are certain that your devices contain no DMA
+	 addressing limitations.

The naming could be a bit better. If I have
[*] DMA zone support
it should actually enable the DMA zone, not disable it. Wind it like you prefer, either
(1) config NO_DMA_ZONE, bool "Disable DMA zone" default n or
(2) config DMA_ZONE, bool "[Enable] DMA zone" default y

	-`J'
Signature · 5 lines
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>