Re: [PATCH] tee: add FOLL_LONGTERM for CMA case when alloc shm

From: David Hildenbrand
Date: Wed May 17 2023 - 14:24:25 EST


On 17.05.23 12:19, Sumit Garg wrote:
On Wed, 17 May 2023 at 15:06, Christoph Hellwig <hch@xxxxxxxxxxxxx> wrote:

On Wed, May 17, 2023 at 02:56:13PM +0530, Sumit Garg wrote:
Do you mean a pinned user-space page can be paged out automatically?

No, pinned pages can't be paged out.

But a short term pin implies it will be release after a short delay,
and it is feasible for wait for the pin to go away.

Okay, I see. I would be interested to know the ranges for that short
delay. I guess it may depend on how much memory pressure there is...


In general: if user space controls it -> possibly forever -> long-term. Even if in most cases it's a short delay: there is no trusting on user space.

For example, iouring fixed buffers keep pages pinned until user space decides to unregistered the buffers -> long-term.

Short-term is, for example, something like O_DIRECT where we pin -> DMA -> unpin in essentially one operation.

--
Thanks,

David / dhildenb