Re: [RFC PATCH] btrfs: Replace kmap_atomic() with kmap_local_page()
From: Fabio M. De Francesco
Date: Mon Jun 27 2022 - 14:01:41 EST
On venerdì 24 giugno 2022 10:42:15 CEST Fabio M. De Francesco wrote:
> kmap_atomic() is being deprecated in favor of kmap_local_page() where it
> is feasible. With kmap_local_page() mappings are per thread, CPU local,
> and not globally visible.
>
> As far as I can see, the kmap_atomic() calls in compression.c and in
> inode.c can be safely converted.
>
> Above all else, David Sterba has confirmed that "The context in
> check_compressed_csum is atomic [...]" and that "kmap_atomic() in inode.c
> [...] also can be replaced by kmap_local_page().".[1]
>
> Therefore, convert all kmap_atomic() calls currently still left in fs/
btrfs
> to kmap_local_page().
>
> This is an RFC only because, testing with "./check -g quick" (xfstests)
on
> a QEMU + KVM 32-bits VM with 4GB RAM and booting a kernel with
HIGHMEM64GB
> enabled, outputs several errors. These errors seem to be exactly the same
> which are being output without this patch. It apparently seems that these
> changes don't introduce further errors, however I'd like to ask for
> comments before sending a "real" patch.
>
> With this patch, there are no more call sites for kmap() and
kmap_atomic()
> in fs/btrfs.
>
> [1] https://lore.kernel.org/linux-btrfs/
20220601132545.GM20633@xxxxxxxxxxxxx/
>
> Suggested-by: Ira Weiny <ira.weiny@xxxxxxxxx>
> Suggested-by: David Sterba <dsterba@xxxxxxx>
> Signed-off-by: Fabio M. De Francesco <fmdefrancesco@xxxxxxxxx>
> ---
> fs/btrfs/compression.c | 4 ++--
> fs/btrfs/inode.c | 12 ++++++------
> 2 files changed, 8 insertions(+), 8 deletions(-)
>
Please discard this RFC.
I've just submitted a real patch:
https://lore.kernel.org/lkml/20220627174849.29962-1-fmdefrancesco@xxxxxxxxx/
Thanks,
Fabio