On Thu, Mar 13, 2025 at 05:21:36PM +0100, Mikulas Patocka wrote: > > 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. I can't speak for everone else, but bcachefs has those mempools.