lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <b982566a2b9b4825badce36fdfc3032bd0005151.camel@perches.com>
Date:   Thu, 07 Nov 2019 08:55:07 -0800
From:   Joe Perches <joe@...ches.com>
To:     Andrew Morton <akpm@...ux-foundation.org>
Cc:     Andy Whitcroft <apw@...onical.com>,
        LKML <linux-kernel@...r.kernel.org>
Subject: [PATCH] checkpatch: Reduce is_maintained_obsolete lookup runtime

The is_maintained_obsolete function can be called twice
using the same filename.  This function spawns a process
using get_maintainer.pl.  Store the status of each filename
when spawned and use the stored result to eliminate the
spawning of unnecessary duplicate child processes.

Example:

old:

$ time ./scripts/checkpatch.pl hp100-Move-to-staging.patch > /dev/null

real	0m1.767s
user	0m1.634s
sys	0m0.141s

new:

$ time ./scripts/checkpatch.pl hp100-Move-to-staging.patch > /dev/null

real	0m1.184s
user	0m1.085s
sys	0m0.103s

Signed-off-by: Joe Perches <joe@...ches.com>
---
 scripts/checkpatch.pl | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index a85d719..8756c2 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -888,14 +888,18 @@ sub seed_camelcase_file {
 	}
 }
 
+our %maintained_status = ();
+
 sub is_maintained_obsolete {
 	my ($filename) = @_;
 
 	return 0 if (!$tree || !(-e "$root/scripts/get_maintainer.pl"));
 
-	my $status = `perl $root/scripts/get_maintainer.pl --status --nom --nol --nogit --nogit-fallback -f $filename 2>&1`;
+	if (!exists($maintained_status{$filename})) {
+		$maintained_status{$filename} = `perl $root/scripts/get_maintainer.pl --status --nom --nol --nogit --nogit-fallback -f $filename 2>&1`;
+	}
 
-	return $status =~ /obsolete/i;
+	return $maintained_status{$filename} =~ /obsolete/i;
 }
 
 sub is_SPDX_License_valid {


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ