Thread (13 messages) 13 messages, 6 authors, 2023-05-23

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

From: Sumit Garg <hidden>
Date: 2023-05-18 06:08:37
Also in: linux-mediatek, linux-mm, lkml, op-tee

On Thu, 18 May 2023 at 09:51, Christoph Hellwig [off-list ref] wrote:
On Wed, May 17, 2023 at 08:23:33PM +0200, David Hildenbrand wrote:
quoted
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.
Btw, one thing that's been on my mind is that I think we got the
polarity on FOLL_LONGTERM wrong.  Instead of opting into the long term
behavior it really should be the default, with a FOLL_EPHEMERAL flag
to opt out of it.  And every users of this flag is required to have
a comment explaining the life time rules for the pin..
It does look like a better approach to me given the very nature of
user space pages.

-Sumit

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help