]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
highmem: add folio_test_partial_kmap()
authorMatthew Wilcox (Oracle) <willy@infradead.org>
Wed, 14 May 2025 17:06:02 +0000 (18:06 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 29 May 2025 09:14:04 +0000 (11:14 +0200)
commitcb35cc251e128f8a3031602f81cbd30d9d90bbc8
treeacfa8485249cd951d678a8d41be90f9aea301ec6
parent3cc733e6d96c938d2b82be96858a0ab900eb6fdc
highmem: add folio_test_partial_kmap()

commit 97dfbbd135cb5e4426f37ca53a8fa87eaaa4e376 upstream.

In commit c749d9b7ebbc ("iov_iter: fix copy_page_from_iter_atomic() if
KMAP_LOCAL_FORCE_MAP"), Hugh correctly noted that if KMAP_LOCAL_FORCE_MAP
is enabled, we must limit ourselves to PAGE_SIZE bytes per call to
kmap_local().  The same problem exists in memcpy_from_folio(),
memcpy_to_folio(), folio_zero_tail(), folio_fill_tail() and
memcpy_from_file_folio(), so add folio_test_partial_kmap() to do this more
succinctly.

Link: https://lkml.kernel.org/r/20250514170607.3000994-2-willy@infradead.org
Fixes: 00cdf76012ab ("mm: add memcpy_from_file_folio()")
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Hugh Dickins <hughd@google.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
include/linux/highmem.h
include/linux/page-flags.h