linux/fs/isofs
Fabio M. De Francesco 5bb6ce3aeb fs/isofs: replace kmap() with kmap_local_page()
The use of kmap() is being deprecated in favor of kmap_local_page().

There are two main problems with kmap(): (1) It comes with an overhead as
mapping space is restricted and protected by a global lock for
synchronization and (2) it also requires global TLB invalidation when the
kmap's pool wraps and it might block when the mapping space is fully
utilized until a slot becomes available.

With kmap_local_page() the mappings are per thread, CPU local, can take
page faults, and can be called from any context (including interrupts). 
Tasks can be preempted and, when scheduled to run again, the kernel
virtual addresses are restored and still valid.  It is faster than kmap()
in kernels with HIGHMEM enabled.

Since kmap_local_page() can be safely used in compress.c, it should be
called everywhere instead of kmap().

Therefore, replace kmap() with kmap_local_page() in compress.c.  Where it
is needed, use memzero_page() instead of open coding kmap_local_page()
plus memset() to fill the pages with zeros.  Delete the redundant
flush_dcache_page() in the two call sites of memzero_page().

Tested with mkisofs on a QEMU/KVM x86_32 VM, 6GB RAM, booting a kernel
with HIGHMEM64GB enabled.

Link: https://lkml.kernel.org/r/20220801122709.8164-1-fmdefrancesco@gmail.com
Signed-off-by: Fabio M. De Francesco <fmdefrancesco@gmail.com>
Suggested-by: Ira Weiny <ira.weiny@intel.com>
Reviewed-by: Jan Kara <jack@suse.cz>
Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
Cc: Roman Gushchin <roman.gushchin@linux.dev>
Cc: Pali Rohár <pali@kernel.org>
Cc: Muchun Song <songmuchun@bytedance.com>
Cc: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
2022-09-11 21:55:05 -07:00
..
compress.c fs/isofs: replace kmap() with kmap_local_page() 2022-09-11 21:55:05 -07:00
dir.c isofs: remove redundant continue statement 2021-06-17 17:11:42 +02:00
export.c docs: fs: convert docs without extension to ReST 2019-07-31 13:31:05 -06:00
inode.c fs: Convert mpage_readpage to mpage_read_folio 2022-05-09 16:21:44 -04:00
isofs.h isofs: joliet: Fix iocharset=utf8 mount option 2021-08-12 16:07:14 +02:00
joliet.c isofs: joliet: Fix iocharset=utf8 mount option 2021-08-12 16:07:14 +02:00
Kconfig docs: filesystems: fix renamed references 2020-04-20 15:45:22 -06:00
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
namei.c isofs: release buffer head before return 2021-01-25 17:57:38 +01:00
rock.c isofs: Convert symlinks and zisofs to read_folio 2022-05-09 16:21:45 -04:00
rock.h fs: Replace zero-length array with flexible-array member 2020-10-29 17:22:59 -05:00
util.c Merge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs 2017-11-14 14:13:11 -08:00
zisofs.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 142 2019-05-30 11:25:17 -07:00