Skip to contentSkip to conversation

checkstack-sort-output-by-size-and-function-name.patch removed from -mm tree

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

lore
Share & tools
lore

Andrew Morton

author tree notice Applied
#0 lore raw

The quilt patch titled
Subject: checkstack: sort output by size and function name
has been removed from the -mm tree. Its filename was
checkstack-sort-output-by-size-and-function-name.patch

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

------------------------------------------------------
From: Heiko Carstens <[email protected]>
Subject: checkstack: sort output by size and function name
Date: Mon, 20 Nov 2023 19:37:18 +0100

Sort output by size and in addition by function name. This increases readability for cases where there are many functions with the same stack usage.

---

 scripts/checkstack.pl |   19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)
scripts/checkstack.pl renamed from scripts/checkstack.pl~checkstack-sort-output-by-size-and-function-name +17 -2
@@ -189,5 +189,20 @@ if ($total_size > $min_stack) {
 	push @stack, "$intro$total_size\n";
 }
 
-# Sort output by size (last field)
-print sort { ($b =~ /:\t*(\d+)$/)[0] <=> ($a =~ /:\t*(\d+)$/)[0] } @stack;
+# Sort output by size (last field) and function name if size is the same
+sub sort_lines {
+	my ($a, $b) = @_;
+
+	my $num_a = $1 if $a =~ /:\t*(\d+)$/;
+	my $num_b = $1 if $b =~ /:\t*(\d+)$/;
+	my $func_a = $1 if $a =~ / (.*):/;
+	my $func_b = $1 if $b =~ / (.*):/;
+
+	if ($num_a != $num_b) {
+		return $num_b <=> $num_a;
+	} else {
+		return $func_a cmp $func_b;
+	}
+}
+
+print sort { sort_lines($a, $b) } @stack;

_

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