Re: [PATCH] the dm-loop target

Mikulas Patocka
2025-03-13T16:21:52Z

> IS_SWAPFILE isn't going way, as can't allow other writers to it.
> Also asides from the that the layouts are fairly complex.
>
> The right way ahead for swap is to literally just treat it as a slightly
> special case of direct I/o that is allowed to IS_SWAPFILE files. We
> can safely do writeback to file backed folios under memory pressure,
> so we can also go through the normal file system path.

But that is prone to low-memory-deadlock because the filesystems allocate
buffer memory when they are mapping logical blocks to physical blocks. You
would need to have a mempool in the filesystems, so that they can make
forward progress even if there is no memory free - and that would
complicate them.

GFP_NOIO won't help if the memory is completely exhausted. Only mempool
would help in this situation.

Mikulas