|
|
Subscribe / Log in / New account

Is it time to remove ZONE_DMA?

Is it time to remove ZONE_DMA?

Posted May 7, 2018 11:44 UTC (Mon) by cborni (subscriber, #12949)
Parent article: Is it time to remove ZONE_DMA?

Unfortunately ZONE_DMA does not always mean the lowest 16MB.
On s390 we use GFP_DMA to allocate buffers below 2GB. This is still necessary for several hardware interfaces so we certainly need a way to allocate buffers in that region.


to post comments

Is it time to remove ZONE_DMA?

Posted May 7, 2018 16:13 UTC (Mon) by willy (subscriber, #9762) [Link] (1 responses)

Can you use GFP_DMA32 for that purpose, or do you need it to refer to the full 4GB?

Is it time to remove ZONE_DMA?

Posted May 7, 2018 16:47 UTC (Mon) by cborni (subscriber, #12949) [Link]

We need it to be below 2GB (the old 31bit mode has survived in some places).
Right now ZONE_DMA is defined to be exactly that on s390x. We could of course redefine everything to be GFP_DMA32 (which does not exist yet) but this seems a pointless rename.

Is it time to remove ZONE_DMA?

Posted May 7, 2018 16:17 UTC (Mon) by willy (subscriber, #9762) [Link] (1 responses)

By the way, the intended way for drivers to allocate memory below 2GB is the DMA allocation API with a mask of 1<<31 -1. Is that doable? GFP_DMA might be used to implement that interface, but it's easier to deal with that than dozens of drivers.

Is it time to remove ZONE_DMA?

Posted May 7, 2018 17:04 UTC (Mon) by cborni (subscriber, #12949) [Link]

> By the way, the intended way for drivers to allocate memory below 2GB is the DMA allocation API with a mask of 1<<31 -1. Is that doable?

No. This is not about driver code, this is about core code that calls some classic CISC instructions that require control blocks that might have some satellite blocks via pointers. And sometimes some specific satellite blocks need to be below 2GB.

Another thing about dma mask: This does not keep this area free unless needed. GFP_DMA does that.
Imagine a system with 3 GB of memory.
2GB ZONE_DMA
1GB ZONE_NORMAL (or movable)

If the page cache now needs 2GB, it will consome the 1GB in ZONE_NORMAL and after that 1GB in ZONE_DMA. So we can still handle all DMA requests. If we have no dedicated zone then there is is higher chance that pages <2GB are used making allocation in there less likely.

So I think your understanding of ZONE_DMA usage (the x86 way) is not exactly how s390x uses it - I fear.


Copyright © 2025, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds