mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2025-01-01 10:42:11 +00:00
leaking_addresses: cache architecture name
Currently we are repeatedly calling `uname -m`. This is causing the script to take a long time to run (more than 10 seconds to parse /proc/kallsyms). We can use Perl state variables to cache the result of the first call to `uname -m`. With this change in place the script scans the whole kernel in under a minute. Cache machine architecture in state variable. Signed-off-by: Tobin C. Harding <me@tobin.cc>
This commit is contained in:
parent
b401f56f33
commit
5e4bac34ed
@ -175,7 +175,7 @@ sub is_32bit
|
|||||||
|
|
||||||
sub is_ix86_32
|
sub is_ix86_32
|
||||||
{
|
{
|
||||||
my $arch = `uname -m`;
|
state $arch = `uname -m`;
|
||||||
|
|
||||||
chomp $arch;
|
chomp $arch;
|
||||||
if ($arch =~ m/i[3456]86/) {
|
if ($arch =~ m/i[3456]86/) {
|
||||||
@ -198,12 +198,14 @@ sub is_arch
|
|||||||
|
|
||||||
sub is_x86_64
|
sub is_x86_64
|
||||||
{
|
{
|
||||||
return is_arch('x86_64');
|
state $is = is_arch('x86_64');
|
||||||
|
return $is;
|
||||||
}
|
}
|
||||||
|
|
||||||
sub is_ppc64
|
sub is_ppc64
|
||||||
{
|
{
|
||||||
return is_arch('ppc64');
|
state $is = is_arch('ppc64');
|
||||||
|
return $is;
|
||||||
}
|
}
|
||||||
|
|
||||||
# Gets config option value from kernel config file.
|
# Gets config option value from kernel config file.
|
||||||
|
Loading…
Reference in New Issue
Block a user