Why cann’t we remove the ZONE_DMA from Linux

原创文章,转载请注明出处.转载自: Li Haifeng's Blog
本文链接地址: Why cann’t we remove the ZONE_DMA from Linux


这是在linux-kernel mail list上的答案:


While ISA is gone as a true peripheral interconnect for new systems it does, 
actually, still live on in a lot of systems that Linux still supports. While
those systems, generally, are running the same kernel and userspace they were
a decade ago I have no doubt that somebody might find an old machine and put
Linux on it - just because they could.

And that also discounts the non-IBM PC machines that are out there that Linux
also supports. While I don't know enough about them to say for sure, I am
quite certain that at least some of them are still using the ISA bus.


> Thanks for your reply.And do you means that , If I use a modern PC,such as
> my pc (CPU:Intel dual-core 2.6GHZ; Memory 2GB; And no pci ).I can remove
> the ZONE_DMA .And make sure this system also run smoothly as before?

*MAYBE* - if you don't use parallel ports, floppy drives or similar. There
actually are still a lot of devices that use the ISA bus in a modern PC - even
the keyboard (well, not USB ones) is an ISA device.

Simple fact is that if it was possible to configure it out and not cause
massive problems somebody would have already spun out a patch to allow just


Incorrect about that. The i810 chipset doesn’t support the ISA bus as an
*EXPANSION* *BUS* – it does, however, have an internal ISA bus that happens to
be hardwired for certain chips. Among those chips is the keyboard controller
that is a part of the PS/2 keyboard and mouse system. But for those components
that do DMA… Look at the parallel port and the floppy drive – both
(technically) live on the ISA bus.
But I’m not a hardware expert by any stretch – most of what I know is gleaned
from reading code and manual. However… the bits I’m talking about have
interfaces that are, for the most part, carved in stone. Changing them would
require adding circuitry to allow the existing interface continued function -
so I doubt anyone has changed them. (I mean… it’d be almost stupid – have
you ever really looked at the amount of real-estate on a modern MB devoted to
nothing but making sure traces are properly routed? There is a reason they
talk about boards being “4 layer” and such…)


Last I heard this discussed it was mentioned that there were some 
fairly common integrated sound devices using ISA DMA.

As for the i810 chipset not supporting ISA that isn't really true. No
one implements ISA plug-in slots, but at least in the for of LPC
hardware that is effectively ISA continues to be supported for various
legacy devices.

Ultimately I don't see much point in disabling ZONE_DMA. It is a lot of
work to track down if it is really needed, and it only costs 16MB. So
unless someone shows me that ZONE_DMA triggers the OOM killer unnecessarily
or otherwise impacts the system what does legacy code hurt?



Some onboard motherboard devices may also be ISA devices.

Thomas Fjellstrom


Floppy disks & paralell ports still use DMA



There are a couple of reasons to keep ZONE_DMA. It is not used by ISA
device drivers exclusivly. Old style PCI devices may have small DMA
masks (so they could address between 16 MB and 4GB depending on the
device) too. Drivers for these devices often use ZONE_DMA as a fallback
if they can't allocate memory addressable by the device using
ZONE_NORMAL. So there is a use for ZONE_DMA with 32bit PCI too.
(And I also remember I have seen an AM2 board with an ISA slot for
embedded purposes too, so ISA is not completly dead)



I think Joerg is right. In short wods, ZONE_DMA is not only an relative thing to ISA devices. ISA devices need it in the ancient board because they could not refer to all the memory addresses which are usually 32-bit, on the contrary, ISA devices just use 24-bit address. ZONE_DMA serves those kmalloc call with GFP_DMA and __GFP_DMA flags, and that is the true meaning of it.
It is not reasonable to truncate ZONE_DMA, because although it could be defined as a size of 16MB, the actual size of DMA transferring region is decided by the watermark of  ZONE_NORMAL. It is saying that a part of ZONE_DMA could be used as ZONE_NORMAL memory when lowmem_reserved_ratio is set to a certain value. Refer to Documentation/sysctl/vm.txt for more information.
Best regards,

Adam Jiang




From Li Haifeng's Blog, post Why cann’t we remove the ZONE_DMA from Linux

Post Footer automatically generated by wp-posturl plugin for wordpress.