Skip to contentSkip to conversation

FAILED: patch "[PATCH] tools/mm/page_owner_sort: fix timestamp comparison for stable" failed to apply to 6.1-stable tree

PATCH [email protected] 1 participant 1 message Jan 5

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

The 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 7013803444dd3bbbe28fd3360c084cec3057c554
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2026010519-jawline-playing-8c04@gregkh' --subject-prefix 'PATCH 6.1.y' HEAD^..

Possible dependencies:

thanks,

greg k-h

------------------ original commit in Linus's tree ------------------

From 7013803444dd3bbbe28fd3360c084cec3057c554 Mon Sep 17 00:00:00 2001
From: Kaushlendra Kumar <[email protected]>
Date: Tue, 9 Dec 2025 10:15:52 +0530
Subject: [PATCH] tools/mm/page_owner_sort: fix timestamp comparison for stable
sorting

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 +5 -1
index 14c67e9e84c4..e6954909401c 100644
@@ -181,7 +181,11 @@ static int compare_ts(const void *p1, const void *p2)
 {
 	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)