Skip to contentSkip to conversation

tools-mm-page_owner_sort-fix-timestamp-comparison-for-stable-sorting.patch removed from -mm tree

merged mm-hotfixes-stable Andrew Morton 1 participant 1 message Dec 23, 2025 Stable branch

lore
Share & tools
lore

Andrew Morton

author tree notice Applied
#0 lore raw

The quilt patch titled
Subject: tools/mm/page_owner_sort: fix timestamp comparison for stable sorting
has been removed from the -mm tree. Its filename was
tools-mm-page_owner_sort-fix-timestamp-comparison-for-stable-sorting.patch

This patch was dropped because it was merged into the mm-hotfixes-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

------------------------------------------------------
From: Kaushlendra Kumar <[email protected]>
Subject: tools/mm/page_owner_sort: fix timestamp comparison for stable sorting
Date: Tue, 9 Dec 2025 10:15:52 +0530

The ternary operator in compare_ts() returns 1 when timestamps are equal, causing unstable sorting behavior. Replace with explicit three-way comparison that returns 0 for equal timestamps, ensuring stable qsort ordering and consistent output.

Fixes 8f9c447e2e2b ("tools/vm/page_owner_sort.c: support sorting pid and time")
Cc Chongxi Zhao <[email protected]>

---

 tools/mm/page_owner_sort.c |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
tools/mm/page_owner_sort.c renamed from tools/mm/page_owner_sort.c~tools-mm-page_owner_sort-fix-timestamp-comparison-for-stable-sorting +5 -1
@@ -181,7 +181,11 @@ static int compare_ts(const void *p1, co
 {
 	const struct block_list *l1 = p1, *l2 = p2;
 
-	return l1->ts_nsec < l2->ts_nsec ? -1 : 1;
+	if (l1->ts_nsec < l2->ts_nsec)
+		return -1;
+	if (l1->ts_nsec > l2->ts_nsec)
+		return 1;
+	return 0;
 }
 
 static int compare_cull_condition(const void *p1, const void *p2)

_

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

tools-mm-thp_swap_allocator_test-fix-small-folio-alignment.patch tools-mm-slabinfo-fix-partial-long-option-mapping.patch