# Re: use exact allocation for dma coherent memory

- From: Arend Van Spriel \<arend.vanspriel@broadcom.com\>
- Date: 2019-07-02 09:48:52 
- List: netdev
- Page: https://ratatoskr.run/netdev/2019/07/5645687
- Thread: https://ratatoskr.run/linux-s390/2019/06/5629039/t.md

```text


On 7/1/2019 10:48 AM, Christoph Hellwig wrote:
> On Fri, Jun 14, 2019 at 03:47:10PM +0200, Christoph Hellwig wrote:
>> Switching to a slightly cleaned up alloc_pages_exact is pretty easy,
>> but it turns out that because we didn't filter valid gfp_t flags
>> on the DMA allocator, a bunch of drivers were passing __GFP_COMP
>> to it, which is rather bogus in too many ways to explain.  Arm has
>> been filtering it for a while, but this series instead tries to fix
>> the drivers and warn when __GFP_COMP is passed, which makes it much
>> larger than just adding the functionality.
>
> Dear driver maintainers,
>
> can you look over the patches touching your drivers, please?  I'd
> like to get as much as possible of the driver patches into this
> merge window, so that it can you through your maintainer trees.

You made me look ;-) Actually not touching my drivers so I'm off the hook. However, I was wondering if drivers could know so I decided to look into the DMA-API.txt documentation which currently states:

"""
The flag parameter (dma_alloc_coherent() only) allows the caller to
specify the ``GFP_`` flags (see kmalloc()) for the allocation (the
implementation may choose to ignore flags that affect the location of
the returned memory, like GFP_DMA).
"""

I do expect you are going to change that description as well now that you are going to issue a warning on __GFP_COMP. Maybe include that in patch 15/16 where you introduce that warning.

Regards,
Arend
```
