selftests-mm-protection_keys-use-library-code-for-hugetlb-setup.patch removed from -mm tree
The quilt patch titled
Subject: selftests/mm: protection_keys: use library code for HugeTLB setup
has been removed from the -mm tree. Its filename was
selftests-mm-protection_keys-use-library-code-for-hugetlb-setup.patch
This patch was dropped because it was merged into the mm-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
------------------------------------------------------
From: "Mike Rapoport (Microsoft)" <[email protected]>
Subject: selftests/mm: protection_keys: use library code for HugeTLB setup
Date: Mon, 11 May 2026 19:28:31 +0300
protection_keys open codes setup of HugeTLB pages.
Replace it with the library functions from hugepage_setup.
Replace exit() calls with _exit() to avoid restoring HugeTLB settings in the middle of test.
---
tools/testing/selftests/mm/protection_keys.c | 50 ++++------------- 1 file changed, 14 insertions(+), 36 deletions(-)
tools/testing/selftests/mm/protection_keys.c renamed from tools/testing/selftests/mm/protection_keys.c~selftests-mm-protection_keys-use-library-code-for-hugetlb-setup +14 -36
@@ -62,6 +62,7 @@ noinline int read_ptr(int *ptr)return *ptr; } +#if CONTROL_TRACING >0 static void cat_into_file (char *str,char *file) {int fd =open (file,O_RDWR );
@@ -87,7 +88,6 @@ static void cat_into_file(char *str, chaclose (fd); } -#if CONTROL_TRACING >0 static int warned_tracing;static int tracing_root_ok (void ) {
@@ -710,50 +710,28 @@ static void *malloc_pkey_anon_huge(long }static int hugetlb_setup_ok; -#define SYSFS_FMT_NR_HUGE_PAGES "/sys/kernel/mm/hugepages/hugepages-%ldkB/nr_hugepages"#define GET_NR_HUGE_PAGES 10static void setup_hugetlbfs (void ) { -int err; -int fd; -char buf[256 ]; -long hpagesz_kb; -long hpagesz_mb; +long hpagesz_mb =HPAGE_SIZE /1024 /1024 ; +unsigned long free_pages;if (geteuid () !=0 ) {ksft_print_msg ("WARNING: not run as root, can not do hugetlb test\n" );return ; } -cat_into_file (__stringify (GET_NR_HUGE_PAGES ),"/proc/sys/vm/nr_hugepages" ); -/* -* Now go make sure that we got the pages and that they +* Make sure that we got the pages and that they * are PMD-level pages. Someone might have made PUD-level * pages the default. */ - hpagesz_kb =HPAGE_SIZE /1024 ; - hpagesz_mb = hpagesz_kb /1024 ; -sprintf (buf,SYSFS_FMT_NR_HUGE_PAGES , hpagesz_kb); - fd =open (buf,O_RDONLY ); -if (fd <0 ) { -fprintf (stderr,"opening sysfs %ldM hugetlb config: %s\n" , - hpagesz_mb,strerror (errno)); -return ; - } - -/* -1 to guarantee leaving the trailing \0 */ - err =read (fd, buf,sizeof (buf)-1 ); -close (fd); -if (err <=0 ) { -fprintf (stderr,"reading sysfs %ldM hugetlb config: %s\n" , - hpagesz_mb,strerror (errno)); -return ; - } - -if (atoi (buf) !=GET_NR_HUGE_PAGES ) { -fprintf (stderr,"could not confirm %ldM pages, got: '%s' expected %d\n" , - hpagesz_mb, buf,GET_NR_HUGE_PAGES ); +hugetlb_save_settings (); +hugetlb_set_nr_pages (HPAGE_SIZE ,GET_NR_HUGE_PAGES ); + free_pages =hugetlb_free_pages (HPAGE_SIZE ); +if (free_pages <GET_NR_HUGE_PAGES ) { +ksft_print_msg ("could not confirm %ldM pages, got: '%lu' expected %d\n" , + hpagesz_mb, free_pages,GET_NR_HUGE_PAGES );return ; }
@@ -1130,7 +1108,7 @@ static void become_child(void)/* in the child */ return ; } -exit (0 ); +_exit (0 ); }/* Assumes that all pkeys other than 'pkey' are unallocated */
@@ -1509,18 +1487,18 @@ static void test_ptrace_modifies_pkru(in* checking */ if (__read_pkey_reg () != new_pkru) -exit (1 ); +_exit (1 );/* Stop and allow the tracer to clear XSTATE_BV for PKRU */ raise (SIGSTOP );if (__read_pkey_reg () !=0 ) -exit (1 ); +_exit (1 );/* Stop and allow the tracer to examine PKRU */ raise (SIGSTOP ); -exit (0 ); +_exit (0 ); }pkey_assert (child ==waitpid (child, &status,0 ));
_
Patches currently in -mm which might be from [email protected] are