public inbox for linux-kbuild@vger.kernel.org
 help / color / mirror / Atom feed
From: WANG Cong <xiyou.wangcong@gmail.com>
To: Sam Ravnborg <sam@ravnborg.org>
Cc: Vegard Nossum <vegard.nossum@gmail.com>,
	linux-kbuild <linux-kbuild@vger.kernel.org>,
	LKML <linux-kernel@vger.kernel.org>,
	David Woodhouse <dwmw2@infradead.org>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Jan Engelhardt <jengelh@computergmbh.de>
Subject: Re: [PATCH] Speed up "make headers_*"
Date: Sun, 8 Jun 2008 19:01:51 +0800	[thread overview]
Message-ID: <20080608110151.GB2487@hacking> (raw)
In-Reply-To: <20080608104122.GA10545@uranus.ravnborg.org>

On Sun, Jun 08, 2008 at 12:41:22PM +0200, Sam Ravnborg wrote:
>On Sun, Jun 08, 2008 at 12:12:35PM +0200, Vegard Nossum wrote:
>> On Sun, Jun 8, 2008 at 11:47 AM, Sam Ravnborg <sam@ravnborg.org> wrote:
>> > This is just a heads up patch if anyone is interested.
>> > I finally took the time needed to optimize the
>> > make headers_* targets.
>> >
>> > On my box it now takes less than 10 seconds to run
>> > the full install + check cycle.
>> > And it generates roughtly one screen full of output.
>> >
>> > Compare that to ~31 seconds and output filling up
>> > my scroll back buffer.
>> 
>> Nice :-)
>> 
>> > Comments (especially to the perl scripts) are welcome.
>> 
>> Will do! Some of my comments are a bit on the pedantic side, so you
>> choose yourself which ones you want to heed!
>
>Thnaks!
>
>headers_install.pl looks like this now.
>I am not happy about the way I call unifdef - can it be
>done better?
>No error handling and I like to avid the extra tmp file.


I think you can open a pipe in Perl, e.g. open FILE, "|scripts/unifdef";.


>
>	Sam
>
>#!/usr/bin/perl
>#
># headers_install prepare the listed header files for use in
># user space and copy the files to their destination.
>#
># Usage: headers_install.pl odir installdir [files...]
># odir:    dir to open files
># install: dir to install the files
># files:   list of files to check
>#
># Step in preparation for users space:
># 1) Drop all use of compiler.h definitions
># 2) Drop include of compiler.h
># 3) Drop all sections defined out by __KERNEL__
>
>use strict;
>use warnings;
>
>my ($odir, $installdir, @files) = @ARGV;
>
>my $ret = 0;


This is only used by last exit, thus can be removed.

>
>foreach my $file (@files) {
>	open(my $infile, '<', "$odir/$file") or die "$odir/$file: $!\n";
>	open(my $outfile, '>', "$installdir/$file.tmp") or
>		die "$installdir/$file.tmp: $!\n";
>	while (my $line = <$infile>) {
>		$line =~ s/([\s(])__user\s/$1/g;
>		$line =~ s/([\s(])__force\s/$1/g;
>		$line =~ s/([\s(])__iomem\s/$1/g;
>		$line =~ s/\s__attribute_const__\s/ /g;
>		$line =~ s/\s__attribute_const__$//g;
>		$line =~ s/^#include <linux\/compiler.h>//;
>		printf $outfile "%s", $line;
>	}
>	close($outfile);
>	close($outfile);


'close' doesn't need parenthesises neither.

>	system "scripts/unifdef -U__KERNEL__ $installdir/$file.tmp > $installdir/$file"


Will scripts/unifdef clean the tmp file? If not, you should do it, right?


>}
>
>exit $ret;
>


-- 
Hi, I'm a .signature virus, please copy/paste me to help me spread
all over the world.

  parent reply	other threads:[~2008-06-08 11:05 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-08  9:47 [PATCH] Speed up "make headers_*" Sam Ravnborg
2008-06-08 10:12 ` Vegard Nossum
2008-06-08 10:41   ` Sam Ravnborg
2008-06-08 10:49     ` David Woodhouse
2008-06-08 11:17       ` Sam Ravnborg
2008-06-08 12:23         ` Oleg Verych
2008-06-08 13:17         ` David Woodhouse
2008-06-08 17:06           ` Segher Boessenkool
2008-06-08 17:34             ` Andreas Schwab
2008-06-08 19:45               ` Segher Boessenkool
2008-06-08 20:36           ` Geert Uytterhoeven
2008-06-08 11:01     ` WANG Cong [this message]
2008-06-08 11:18       ` Sam Ravnborg
2008-06-08 11:06     ` Vegard Nossum
2008-06-08 11:20       ` Sam Ravnborg
2008-06-08 11:20 ` David Woodhouse
2008-06-08 11:30   ` Sam Ravnborg
2008-06-08 11:47     ` David Woodhouse
2008-06-08 12:14       ` David Woodhouse
2008-06-08 12:29         ` David Woodhouse
2008-06-08 20:07 ` Sam Ravnborg
2008-06-08 20:58   ` David Woodhouse
2008-06-08 21:13     ` Sam Ravnborg
2008-06-09  6:23     ` Sam Ravnborg
2008-06-08 20:07 ` [PATCH 1/6] kbuild: refactor headers_* targets in Makefile Sam Ravnborg
2008-06-08 20:07 ` [PATCH 2/6] kbuild: always unifdef files in headers_install* Sam Ravnborg
2008-06-08 20:07 ` [PATCH 3/6] kbuild: drop support of ALTARCH for headers_* Sam Ravnborg
2008-06-08 20:07 ` [PATCH 4/6] kbuild: code refactoring in Makefile.headerinst Sam Ravnborg
2008-06-08 20:07 ` [PATCH 5/6] kbuild: error out early in make headers_install Sam Ravnborg
2008-06-09 10:19   ` David Woodhouse
2008-06-08 20:07 ` [PATCH 6/6] kbuild: optimize headers_* targets Sam Ravnborg
2008-06-08 20:37   ` Vegard Nossum
2008-06-08 21:15     ` Sam Ravnborg
  -- strict thread matches above, loose matches on Subject: below --
2008-06-26  1:59 [PATCH] Speed up "make headers_*" Tim Schmielau
2008-06-26  7:11 ` Adrian Bunk

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=20080608110151.GB2487@hacking \
    --to=xiyou.wangcong@gmail.com \
    --cc=dwmw2@infradead.org \
    --cc=jengelh@computergmbh.de \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sam@ravnborg.org \
    --cc=torvalds@linux-foundation.org \
    --cc=vegard.nossum@gmail.com \
    /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