On Wed, Mar 12, 2025 at 07:20:11AM -0700, Christoph Hellwig wrote: > On Wed, Mar 12, 2025 at 09:26:55AM -0400, Kent Overstreet wrote: > > We might be able to provide an API to _request_ a stable mapping to a > > file - with proper synchronization, of course. > > We already have that with the pNFS layouts. Good point, maybe Mikulas wants to look at that if they care about squeezing every iops... > > > I don't recall anyone ever trying that, it'd replace all the weird > > IF_SWAPFILE() hacks and be a safe way to do these kinds of performance > > optimizations. > > 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. Yeah, and that gets us e.g. encrypted swap on bcachefs