Re: [PATCH v2 09/17] mm: Add unsafe_follow_pfn

From: Marek Szyprowski
Date: Mon Oct 12 2020 - 06:47:01 EST


Hi Jason,

On 09.10.2020 14:48, Jason Gunthorpe wrote:
> On Fri, Oct 09, 2020 at 02:37:23PM +0200, Mauro Carvalho Chehab wrote:
>
>> I'm not a mm/ expert, but, from what I understood from Daniel's patch
>> description is that this is unsafe *only if* __GFP_MOVABLE is used.
> No, it is unconditionally unsafe. The CMA movable mappings are
> specific VMAs that will have bad issues here, but there are other
> types too.

I'm trying to follow this thread, but I really wonder what do you mean
by CMA movable mappings? If a buffer has been allocated from CMA and
used for DMA, it won't be moved in the memory. It will stay at the same
physical memory address all the time until freed by the owner. It just a
matter of proper usage count tracking to delay freeing if it is still
used somewhere.

Best regards

--
Marek Szyprowski, PhD
Samsung R&D Institute Poland