Skip to content

Commit

Permalink
[PATCH] checkstack: print module names
Browse files Browse the repository at this point in the history
Finding "init_module" high stack usage problems is challenging when there
are over 1600 "init_module" functions in the kernel tree, so make
checkstack.pl print out the filename where the stack usage occurs.  This is
useful for code built as loadable modules.

For built-in code, it just prints the kernel image file name, like
"vmlinux".  Examples:

(before patch:)
0x0000000d callback:					1928
0xffffffff81678c09 huft_build:				1560
0x0018 init_module:					1512

(after patch:)
0x0000000d callback [divacapi]:				1928
0xffffffff81678c09 huft_build [vmlinux]:		1560
0x0018 init_module [hdaps]:				1512

Also change one if-series to use elsif to cut down on unneeded tests.

Signed-off-by: Randy Dunlap <[email protected]>
Acked-by: Joern Engel <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
rddunlap authored and Linus Torvalds committed Jun 25, 2006
1 parent 5ec3e4b commit 8ad2914
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions scripts/checkstack.pl
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,21 @@ ($)
#
my $funcre = qr/^$x* <(.*)>:$/;
my $func;
my $file, $lastslash;

while (my $line = <STDIN>) {
if ($line =~ m/$funcre/) {
$func = $1;
}
if ($line =~ m/$re/) {
elsif ($line =~ m/(.*):\s*file format/) {
$file = $1;
$file =~ s/\.ko//;
$lastslash = rindex($file, "/");
if ($lastslash != -1) {
$file = substr($file, $lastslash + 1);
}
}
elsif ($line =~ m/$re/) {
my $size = $1;
$size = hex($size) if ($size =~ /^0x/);

Expand All @@ -109,7 +119,7 @@ ($)
$addr =~ s/ /0/g;
$addr = "0x$addr";

my $intro = "$addr $func:";
my $intro = "$addr $func [$file]:";
my $padlen = 56 - length($intro);
while ($padlen > 0) {
$intro .= ' ';
Expand Down

0 comments on commit 8ad2914

Please sign in to comment.