FAILED: patch "[PATCH] highmem: add folio_test_partial_kmap()" failed to apply to 6.6-stable tree
Subsystems (2)
[email protected]
maintainerThe patch below does not apply to the 6.6-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.6.y
git checkout FETCH_HEAD
git cherry-pick -x 97dfbbd135cb5e4426f37ca53a8fa87eaaa4e376
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2025052622-segment-presuming-e4c6@gregkh' --subject-prefix 'PATCH 6.6.y' HEAD^..
Possible dependencies:
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From 97dfbbd135cb5e4426f37ca53a8fa87eaaa4e376 Mon Sep 17 00:00:00 2001
From: "Matthew Wilcox (Oracle)" <[email protected]>
Date: Wed, 14 May 2025 18:06:02 +0100
Subject: [PATCH] highmem: add folio_test_partial_kmap()
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.
include/linux/highmem.h +5 -5
@@ -461,7 +461,7 @@ static inline void memcpy_from_folio(char *to, struct folio *folio,const char *from =kmap_local_folio (folio, offset);size_t chunk = len; -if (folio_test_highmem (folio) && +if (folio_test_partial_kmap (folio) && chunk >PAGE_SIZE -offset_in_page (offset)) chunk =PAGE_SIZE -offset_in_page (offset);memcpy (to, from, chunk);
@@ -489,7 +489,7 @@ static inline void memcpy_to_folio(struct folio *folio, size_t offset,char *to =kmap_local_folio (folio, offset);size_t chunk = len; -if (folio_test_highmem (folio) && +if (folio_test_partial_kmap (folio) && chunk >PAGE_SIZE -offset_in_page (offset)) chunk =PAGE_SIZE -offset_in_page (offset);memcpy (to, from, chunk);
@@ -522,7 +522,7 @@ static inline __must_check void *folio_zero_tail(struct folio *folio, {size_t len =folio_size (folio) - offset; -if (folio_test_highmem (folio)) { +if (folio_test_partial_kmap (folio)) {size_t max =PAGE_SIZE -offset_in_page (offset);while (len > max) {
@@ -560,7 +560,7 @@ static inline void folio_fill_tail(struct folio *folio, size_t offset,VM_BUG_ON (offset + len >folio_size (folio)); -if (folio_test_highmem (folio)) { +if (folio_test_partial_kmap (folio)) {size_t max =PAGE_SIZE -offset_in_page (offset);while (len > max) {
@@ -597,7 +597,7 @@ static inline size_t memcpy_from_file_folio(char *to, struct folio *folio,size_t offset =offset_in_folio (folio, pos);char *from =kmap_local_folio (folio, offset); -if (folio_test_highmem (folio)) { +if (folio_test_partial_kmap (folio)) { offset =offset_in_page (offset); len =min_t (size_t, len,PAGE_SIZE - offset); }else
include/linux/page-flags.h +7 -0
@@ -615,6 +615,13 @@ FOLIO_FLAG(dropbehind, FOLIO_HEAD_PAGE) PAGEFLAG_FALSE(HighMem, highmem)#endif +/* Does kmap_local_folio() only allow access to one page of the folio? */ +#ifdef CONFIG_DEBUG_KMAP_LOCAL_FORCE_MAP +#define folio_test_partial_kmap (f) true +#else +#define folio_test_partial_kmap (f) folio_test_highmem(f) +#endif +#ifdef CONFIG_SWAP static __always_inline bool folio_test_swapcache(const struct folio *folio) {
PATCH 1/1 highmem: add folio_test_partial_kmap()
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.
--- include/linux/highmem.h | 6 +++--- include/linux/page-flags.h | 7 +++++++ 2 files changed, 10 insertions(+), 3 deletions(-)
include/linux/highmem.h +3 -3
@@ -448,7 +448,7 @@ static inline void memcpy_from_folio(char *to, struct folio *folio,const char *from =kmap_local_folio (folio, offset);size_t chunk = len; -if (folio_test_highmem (folio) && +if (folio_test_partial_kmap (folio) && chunk >PAGE_SIZE -offset_in_page (offset)) chunk =PAGE_SIZE -offset_in_page (offset);memcpy (to, from, chunk);
@@ -469,7 +469,7 @@ static inline void memcpy_to_folio(struct folio *folio, size_t offset,char *to =kmap_local_folio (folio, offset);size_t chunk = len; -if (folio_test_highmem (folio) && +if (folio_test_partial_kmap (folio) && chunk >PAGE_SIZE -offset_in_page (offset)) chunk =PAGE_SIZE -offset_in_page (offset);memcpy (to, from, chunk);
@@ -501,7 +501,7 @@ static inline size_t memcpy_from_file_folio(char *to, struct folio *folio,size_t offset =offset_in_folio (folio, pos);char *from =kmap_local_folio (folio, offset); -if (folio_test_highmem (folio)) { +if (folio_test_partial_kmap (folio)) { offset =offset_in_page (offset); len =min_t (size_t, len,PAGE_SIZE - offset); }else
include/linux/page-flags.h +7 -0
@@ -551,6 +551,13 @@ PAGEFLAG(Readahead, readahead, PF_NO_COMPOUND) PAGEFLAG_FALSE(HighMem, highmem)#endif +/* Does kmap_local_folio() only allow access to one page of the folio? */ +#ifdef CONFIG_DEBUG_KMAP_LOCAL_FORCE_MAP +#define folio_test_partial_kmap (f) true +#else +#define folio_test_partial_kmap (f) folio_test_highmem(f) +#endif +#ifdef CONFIG_SWAP static __always_inline bool folio_test_swapcache(struct folio *folio) {
Signature · 1 line
2.47.2