Re: [PATCH 06/12] mm/truncate: add folio_unmap_invalidate() helper
From: Jens Axboe
Date: Thu Dec 12 2024 - 15:23:01 EST
On 12/10/24 4:21 AM, Christoph Hellwig wrote:
> On Tue, Dec 03, 2024 at 08:31:42AM -0700, Jens Axboe wrote:
>> Add a folio_unmap_invalidate() helper, which unmaps and invalidates a
>> given folio. The caller must already have locked the folio. Use this
>> new helper in invalidate_inode_pages2_range(), rather than duplicate
>> the code there.
>
> This new helper ends up the only caller of invalidate_complete_folio2,
> so you might as well merge the two instead of having yet another
> invalidate/unmap helper, which are getting impossible to track of.
Sure, missed that it's the only caller now.
> Also it is only used in mm/, so add the prototype to mm/internal.h
> insead of the public pagemap.h. And a little comment what the function
> does would be pretty useful as well.
Good point, moved to internal.h instead.
>> In preparation for using this elsewhere as well, have it take a gfp_t
>> mask rather than assume GFP_KERNEL is the right choice. This bubbles
>> back to invalidate_complete_folio2() as well.
>
> Looking at the callers the gfp_t looks a bit odd to me, as it is
> either GFP_KERNEL or 0 which is a valid but rather unusuable gfp_t
> value, but I guess this comes form filemap_release_folio which
> works similarly.
Indeed
--
Jens Axboe