FAILED: patch "[PATCH] selftests/mm: ksm_tests should only MADV_HUGEPAGE valid" failed to apply to 6.1-stable tree
Subsystems (3)
[email protected]
maintainerThe patch below does not apply to the 6.1-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.1.y
git checkout FETCH_HEAD
git cherry-pick -x d021b442cf312664811783e92b3d5e4548e92a53
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2024021805-nuzzle-apricot-89e9@gregkh' --subject-prefix 'PATCH 6.1.y' HEAD^..
Possible dependencies:
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From d021b442cf312664811783e92b3d5e4548e92a53 Mon Sep 17 00:00:00 2001
From: Ryan Roberts <[email protected]>
Date: Mon, 22 Jan 2024 12:05:54 +0000
Subject: [PATCH] selftests/mm: ksm_tests should only MADV_HUGEPAGE valid
memory
ksm_tests was previously mmapping a region of memory, aligning the returned pointer to a PMD boundary, then setting MADV_HUGEPAGE, but was setting it past the end of the mmapped area due to not taking the pointer alignment into consideration. Fix this behaviour.
Up until commit efa7df3e3bb5 ("mm: align larger anonymous mappings on THP boundaries"), this buggy behavior was (usually) masked because the alignment difference was always less than PMD-size. But since the mentioned commit, ksm_tests -H -s 100 started failing.
tools/testing/selftests/mm/ksm_tests.c +1 -1
@@ -566,7 +566,7 @@ static int ksm_merge_hugepages_time(int merge_type, int mapping, int prot,if (map_ptr_orig ==MAP_FAILED )err (2 ,"initial mmap" ); -if (madvise (map_ptr, len +HPAGE_SIZE ,MADV_HUGEPAGE )) +if (madvise (map_ptr, len,MADV_HUGEPAGE ))err (2 ,"MADV_HUGEPAGE" ); pagemap_fd =open ("/proc/self/pagemap" ,O_RDONLY );