On Wed, Jan 03, 2024 at 12:48:21AM -0800, Christoph Hellwig wrote: > On Sun, Dec 31, 2023 at 12:40:40PM -0800, Darrick J. Wong wrote: > > From: Darrick J. Wong <djwong@xxxxxxxxxx> > > > > Mapping a page into the kernel's address space is expensive. > > What do you mean with mapping into the kernel's address space? > > Mormally that owuld point to the kmap* family of helpers, but those > are complete no-ops on the typical xfs setups without highmem. But > even with highmem at least kmap_local_page isn't too expensive. > > My xfile diet patches actually change the xfile mapping to never > allocate highmem, which simplifies things a bit (and fixes a bug > in the xfs_buf use that just uses page_address instead of a kmap). > > So I suspect this is something else and more about looking up pages? Sort of both. For xfbtrees (or anything mapping a xfs_buftarg atop an xfile) we can't use the cheap(er) kmap_local_page and have to use kmap, which ... is expensive, isn't it? Granted, forbidding highmem like you posted today makes all of this /much/ simpler so I think it's probably worth the increased chances of ENOMEM on i386. That said, why not avoid a trip through shmem_get_folio_gfp aka filemap_get_entry if we can? Even if we can use page_address directly now? --D