diff options
author | Fabio M. De Francesco | 2022-07-20 18:19:32 +0200 |
---|---|---|
committer | Luis Chamberlain | 2022-07-20 14:27:46 -0700 |
commit | 554694ba120b87e39cf732ed632e6a0c52fafb7c (patch) | |
tree | f6d22932a8db1f5eea46f44cf43f2560f7e0eb9d /drivers/most | |
parent | 6f1dae1d84b6d08541d8e12edd1c8677ab279dea (diff) |
module: Replace kmap() with kmap_local_page()
kmap() is being deprecated in favor of kmap_local_page().
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.
kmap_local_page() is faster than kmap() in kernels with HIGHMEM enabled.
Since the use of kmap_local_page() in module_gzip_decompress() and in
module_xz_decompress() is safe (i.e., it does not break the strict rules
of use), it should be preferred over kmap().
Therefore, replace kmap() with kmap_local_page().
Tested on a QEMU/KVM x86_32 VM with 4GB RAM, booting kernels with
HIGHMEM64GB enabled. Modules compressed with XZ or GZIP decompress
properly.
Cc: Matthew Wilcox <willy@infradead.com>
Suggested-by: Ira Weiny <ira.weiny@intel.com>
Signed-off-by: Fabio M. De Francesco <fmdefrancesco@gmail.com>
Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
Diffstat (limited to 'drivers/most')
0 files changed, 0 insertions, 0 deletions