Re: [RFC PATCH] block, fs: use FOLL_LONGTERM as gup_flags for direct IO

Christoph Hellwig
2025-03-12T15:25:06Z

On Wed, Mar 12, 2025 at 08:20:36AM -0700, Suren Baghdasaryan wrote:
> > Direct I/O pages are not unmovable. They are temporarily pinned for
> > the duration of the direct I/O.
>
> Yes but even temporarily pinned pages can cause CMA allocation
> failure. My point is that if we know beforehand that the pages will be
> pinned we could avoid using CMA and these failures would go away.

Direct I/O (and other users of pin_user_pages) are designed to work
on all anonymous and file backed pages, which is kinda the point.
If you CMA user can't wait for the time of an I/O something is wrong
with that caller and it really should not use CMA.