Skip to contentSkip to conversation

selftests-mm-kugepaged-restore-thp-settings-at-exit.patch removed from -mm tree

merged mm-stable Andrew Morton 1 participant 1 message Dec 20, 2023

lore
Share & tools
lore

Andrew Morton

author tree notice Applied
#0 lore raw

The quilt patch titled
Subject: selftests/mm/kugepaged: restore thp settings at exit
has been removed from the -mm tree. Its filename was
selftests-mm-kugepaged-restore-thp-settings-at-exit.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: Ryan Roberts <[email protected]>
Subject: selftests/mm/kugepaged: restore thp settings at exit
Date: Thu, 7 Dec 2023 16:12:06 +0000

Previously, the saved thp settings would be restored upon a signal or at the natural end of the test suite. But there are some tests that directly call exit() upon failure. In this case, the thp settings were not being restored, which could then influence other tests.

Fix this by installing an atexit() handler to do the actual restore. The signal handler can now just call exit() and the atexit handler is invoked.

Cc Anshuman Khandual <[email protected]>
Cc Barry Song <[email protected]>
Cc Catalin Marinas <[email protected]>
Cc David Rientjes <[email protected]>
Cc "Huang, Ying" <[email protected]>
Cc Hugh Dickins <[email protected]>
Cc Itaru Kitayama <[email protected]>
Cc Kirill A. Shutemov <[email protected]>
Cc Luis Chamberlain <[email protected]>
Cc Matthew Wilcox (Oracle) <[email protected]>
Cc Vlastimil Babka <[email protected]>
Cc Yang Shi <[email protected]>
Cc Yin Fengwei <[email protected]>
Cc Yu Zhao <[email protected]>
Cc Zi Yan <[email protected]>

---

 tools/testing/selftests/mm/khugepaged.c |   17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)
tools/testing/selftests/mm/khugepaged.c renamed from tools/testing/selftests/mm/khugepaged.c~selftests-mm-kugepaged-restore-thp-settings-at-exit +11 -6
@@ -374,18 +374,22 @@ static void pop_settings(void)
 	write_settings(current_settings());
 }
 
-static void restore_settings(int sig)
+static void restore_settings_atexit(void)
 {
 	if (skip_settings_restore)
-		goto out;
+		return;
 
 	printf("Restore THP and khugepaged settings...");
 	write_settings(&saved_settings);
 	success("OK");
-	if (sig)
-		exit(EXIT_FAILURE);
-out:
-	exit(exit_status);
+
+	skip_settings_restore = true;
+}
+
+static void restore_settings(int sig)
+{
+	/* exit() will invoke the restore_settings_atexit handler. */
+	exit(sig ? EXIT_FAILURE : exit_status);
 }
 
 static void save_settings(void)
@@ -415,6 +419,7 @@ static void save_settings(void)
 
 	success("OK");
 
+	atexit(restore_settings_atexit);
 	signal(SIGTERM, restore_settings);
 	signal(SIGINT, restore_settings);
 	signal(SIGHUP, restore_settings);

_

Patches currently in -mm which might be from [email protected] are

selftests-mm-log-run_vmtestssh-results-in-tap-format.patch