Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933244AbbD1I5h (ORCPT ); Tue, 28 Apr 2015 04:57:37 -0400 Received: from mail-wi0-f181.google.com ([209.85.212.181]:35789 "EHLO mail-wi0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933221AbbD1I5e (ORCPT ); Tue, 28 Apr 2015 04:57:34 -0400 MIME-Version: 1.0 In-Reply-To: <1430153019-31596-1-git-send-email-chris.j.arges@canonical.com> References: <553E4633.8080606@suse.cz> <1430153019-31596-1-git-send-email-chris.j.arges@canonical.com> Date: Tue, 28 Apr 2015 11:57:33 +0300 Message-ID: Subject: Re: [PATCH v2] builddeb: parallelize debug module installation From: Riku Voipio To: Chris J Arges Cc: linux-kbuild , mmarek , linux-kernel@vger.kernel.org Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2782 Lines: 58 On 27 April 2015 at 19:43, Chris J Arges wrote: > When building the dbg package, we use a large 'for module in $(find' loop that > can be easily parallelized by using 'find | xargs'. This patch modifies this > loop to use the later paradigm. > > In addition, ensure we add '-n1 -P0' to xargs to run as many processes as > possible. > > Signed-off-by: Chris J Arges > --- > scripts/package/builddeb | 15 ++++++++------- > 1 file changed, 8 insertions(+), 7 deletions(-) > > diff --git a/scripts/package/builddeb b/scripts/package/builddeb > index 88dbf23..538f829 100755 > --- a/scripts/package/builddeb > +++ b/scripts/package/builddeb > @@ -152,16 +152,17 @@ if grep -q '^CONFIG_MODULES=y' $KCONFIG_CONFIG ; then > rmdir "$tmpdir/lib/modules/$version" > fi > if [ -n "$BUILD_DEBUG" ] ; then > - for module in $(find $tmpdir/lib/modules/ -name *.ko -printf '%P\n'); do > - module=lib/modules/$module > - mkdir -p $(dirname $dbg_dir/usr/lib/debug/$module) > + find $tmpdir/lib/modules/ -name *.ko -printf '%P\n' | xargs -n1 -P0 -I {} sh -c ' I would go with -P`getconf _NPROCESSORS_ONLN`. There can be thousands of modules (allmodconfig will make 4500). > + mkdir -p $(dirname '"$dbg_dir"'/usr/lib/debug/lib/modules/$1);'" > # only keep debug symbols in the debug file > - $OBJCOPY --only-keep-debug $tmpdir/$module $dbg_dir/usr/lib/debug/$module > + $OBJCOPY --only-keep-debug $tmpdir/lib/modules/{} \ > + $dbg_dir/usr/lib/debug/lib/modules/{}; > # strip original module from debug symbols > - $OBJCOPY --strip-debug $tmpdir/$module > + $OBJCOPY --strip-debug $tmpdir/lib/modules/{}; > # then add a link to those > - $OBJCOPY --add-gnu-debuglink=$dbg_dir/usr/lib/debug/$module $tmpdir/$module > - done > + $OBJCOPY --add-gnu-debuglink=$dbg_dir/usr/lib/debug/lib/modules/{} \ > + $tmpdir/lib/modules/{}; > + " -- {} > fi > fi > > -- > 1.9.1 > > -- > To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/