From: Ira Weiny <ira.weiny@xxxxxxxxx> The following pattern is used often: kmap() memcpy(), memmove(), or memset() kunmap() The problem with this is 2 fold: 1) This is best done with k[un]map_atomic(). 2) kmap() is expanding and evolving beyond the use of highmem. To the second point we have new functionality being placed behind kmap, such as PKS, which has nothing to do with highmem. Also we have new kmap interfaces, kmap_local() which allow for a more fined grained mapping of pages and would be very appropriate for the above pattern. iov_iter.c already defined 3 functions which do most of what we want. memcpy_from_page() memcpy_to_page() memzero_page() Lift these to the core and enhance with memcpy_page(), memmove_page(), and memset_page(). Then replace the patterns throughout the kernel as appropriate. Once the kmap_local() implementation is finalized the kmap_atomic() can be replaced with kmap_local(). For the moment use kmap_atomic(). Ira Weiny (17): mm/highmem: Lift memcpy_[to|from]_page and memset_page to core drivers/firmware_loader: Use new memcpy_[to|from]_page() drivers/gpu: Convert to mem*_page() fs/afs: Convert to memzero_page() fs/btrfs: Convert to memzero_page() fs/hfs: Convert to mem*_page() interface fs/cifs: Convert to memcpy_page() fs/hfsplus: Convert to mem*_page() fs/f2fs: Remove f2fs_copy_page() fs/freevxfs: Use memcpy_to_page() fs/reiserfs: Use memcpy_from_page() fs/cramfs: Use memcpy_from_page() drivers/target: Convert to mem*_page() drivers/scsi: Use memcpy_to_page() drivers/staging: Use memcpy_to/from_page() lib: Use mempcy_to/from_page() samples: Use memcpy_to/from_page() drivers/base/firmware_loader/fallback.c | 11 +++-- drivers/gpu/drm/gma500/gma_display.c | 7 ++- drivers/gpu/drm/gma500/mmu.c | 4 +- drivers/gpu/drm/i915/gem/i915_gem_shmem.c | 6 +-- drivers/gpu/drm/i915/gt/intel_gtt.c | 9 +--- drivers/gpu/drm/i915/gt/shmem_utils.c | 8 ++-- drivers/scsi/ipr.c | 11 +---- drivers/staging/rts5208/rtsx_transport.c | 8 ++-- drivers/target/target_core_rd.c | 6 +-- drivers/target/target_core_transport.c | 10 ++--- fs/afs/write.c | 5 +-- fs/btrfs/inode.c | 21 +++------ fs/cifs/smb2ops.c | 10 ++--- fs/cramfs/inode.c | 3 +- fs/f2fs/f2fs.h | 10 ----- fs/f2fs/file.c | 3 +- fs/freevxfs/vxfs_immed.c | 6 +-- fs/hfs/bnode.c | 13 ++---- fs/hfsplus/bnode.c | 53 +++++++---------------- fs/reiserfs/journal.c | 9 ++-- include/linux/pagemap.h | 49 +++++++++++++++++++++ lib/iov_iter.c | 21 --------- lib/test_bpf.c | 11 +---- lib/test_hmm.c | 10 +---- samples/vfio-mdev/mbochs.c | 8 ++-- 25 files changed, 119 insertions(+), 193 deletions(-) -- 2.28.0.rc0.12.gb6a658bd00c9