On Wed, Feb 28, 2024 at 11:17:33PM -0500, Kent Overstreet wrote: > On Wed, Feb 28, 2024 at 07:37:58PM +0000, Matthew Wilcox wrote: > > Perhaps broaden this slightly. On the THP Cabal call we just had a > > conversation about the requirements on filesystems in the writeback > > path. We currently tell filesystem authors that the entire writeback > > path must avoid allocating memory in order to prevent deadlock (or use > > GFP_MEMALLOC). Is this appropriate? It's a lot of work to assure that > > writing pagecache back will not allocate memory in, eg, the network stack, > > the device driver, and any other layers the write must traverse. > > Why would you not simply mark the writeback path with > memalloc_nofs_save()? It's not about preventing recursion, it's about guaranteeing forward progres. If you can't allocate a bio, you can't clean memory.