Re: [PATCH mm-unstable] ext4: Convert mext_page_double_lock() to mext_folio_double_lock()

From: Matthew Wilcox
Date: Tue Dec 06 2022 - 15:53:46 EST


On Tue, Dec 06, 2022 at 08:50:02PM +0000, Matthew Wilcox wrote:
> > flags = memalloc_nofs_save();
> > - page[0] = grab_cache_page_write_begin(mapping[0], index1);
> > - if (!page[0]) {
> > + folio[0] = __filemap_get_folio(mapping[0], index1, fgp_flags,
> > + mapping_gfp_mask(mapping[0]));
>
> one
>
> > + if (!folio[0]) {
> > memalloc_nofs_restore(flags);
> > return -ENOMEM;
> > }
> >
> > - page[1] = grab_cache_page_write_begin(mapping[1], index2);
> > + folio[1] = __filemap_get_folio(mapping[1], index2, fgp_flags,
> > + mapping_gfp_mask(mapping[1]));
>
> two

*facepalm*. Those don't contain calls to compound_head(), they contain
calls to folio_file_page(), which is still a moderately-expensive
unnecessary conversion, but a conversion in the other direction.