public inbox for linux-kbuild@vger.kernel.org
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: linux-kernel@vger.kernel.org, linux-kbuild@vger.kernel.org
Cc: John David Yost <johnyost@ptd.net>
Subject: [PATCH 2/4] localmodconfig: Read in orig config file to avoid extra processing
Date: Tue, 19 Jun 2012 22:06:10 -0400	[thread overview]
Message-ID: <20120620025004.584667211@goodmis.org> (raw)
In-Reply-To: 20120620020608.911616775@goodmis.org

[-- Attachment #1: Type: text/plain, Size: 2524 bytes --]

From: Steven Rostedt <srostedt@redhat.com>

Read in the entire config file. If there's a config that we depend on
that happens to be in the core set (not a module) then we do not need
to process it as a module.

Currently, we follow the entire depend and selects even if they
are enabled as core and not modules. By checking to make sure that we
only look at modules we can drop the count a little.

From one of my tests, localmodconfig went from taking 3095 set modules
down to 356 before this patch, and down to 290 modules after the change.

Tested-by: John David Yost <johnyost@ptd.net> # AlleyTrotter
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 scripts/kconfig/streamline_config.pl |   26 ++++++++++++++++++++++++--
 1 file changed, 24 insertions(+), 2 deletions(-)

diff --git a/scripts/kconfig/streamline_config.pl b/scripts/kconfig/streamline_config.pl
index 5c1ce87..ab4985f 100644
--- a/scripts/kconfig/streamline_config.pl
+++ b/scripts/kconfig/streamline_config.pl
@@ -113,6 +113,10 @@ sub find_config {
 
 find_config;
 
+# Read in the entire config file into config_file
+my @config_file = <CIN>;
+close CIN;
+
 # Parse options
 my $localmodconfig = 0;
 my $localyesconfig = 0;
@@ -392,7 +396,20 @@ foreach my $module (keys(%modules)) {
     }
 }
 
+# Read the current config, and see what is enabled. We want to
+# ignore configs that we would not enable anyway.
+
+my %orig_configs;
 my $valid = "A-Za-z_0-9";
+
+foreach my $line (@config_file) {
+    $_ = $line;
+
+    if (/(CONFIG_[$valid]*)=(m|y)/) {
+	$orig_configs{$1} = $2;
+    }
+}
+
 my $repeat = 1;
 
 #
@@ -414,6 +431,11 @@ sub parse_config_dep_select
 
 	    $p =~ s/^[^$valid]*[$valid]+//;
 
+	    # We only need to process if the depend config is a module
+	    if (!defined($orig_configs{$conf}) || !$orig_configs{conf} eq "m") {
+		next;
+	    }
+
 	    if (!defined($configs{$conf})) {
 		# We must make sure that this config has its
 		# dependencies met.
@@ -450,7 +472,8 @@ my %setconfigs;
 
 # Finally, read the .config file and turn off any module enabled that
 # we could not find a reason to keep enabled.
-while(<CIN>) {
+foreach my $line (@config_file) {
+    $_ = $line;
 
     if (/CONFIG_IKCONFIG/) {
 	if (/# CONFIG_IKCONFIG is not set/) {
@@ -478,7 +501,6 @@ while(<CIN>) {
     }
     print;
 }
-close(CIN);
 
 # Integrity check, make sure all modules that we want enabled do
 # indeed have their configs set.
-- 
1.7.10



[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

  parent reply	other threads:[~2012-06-20  2:50 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-20  2:06 [PATCH 0/4] localmodconfig: Improve the number of modules removed Steven Rostedt
2012-06-20  2:06 ` [PATCH 1/4] localmodconfig: Comments and cleanup for streamline_config.pl Steven Rostedt
2012-06-20  2:06 ` Steven Rostedt [this message]
2012-06-20  2:06 ` [PATCH 3/4] localmodconfig: Check if configs are already set for selects Steven Rostedt
2012-06-20  2:06 ` [PATCH 4/4] localmodconfig: Add debug environment variable LOCALMODCONFIG_DEBUG Steven Rostedt
  -- strict thread matches above, loose matches on Subject: below --
2012-07-30 19:43 [PATCH 0/4] [GIT PULL] localmodconfig: Improve module config removal Steven Rostedt
2012-07-30 19:43 ` [PATCH 2/4] localmodconfig: Read in orig config file to avoid extra processing Steven Rostedt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120620025004.584667211@goodmis.org \
    --to=rostedt@goodmis.org \
    --cc=johnyost@ptd.net \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox