lkml.org 
[lkml]   [2015]   [Apr]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2] builddeb: parallelize debug module installation
On 2015-04-28 10:57, Riku Voipio wrote:
> On 27 April 2015 at 19:43, Chris J Arges <chris.j.arges@canonical.com> 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 <chris.j.arges@canonical.com>
>> ---
>> 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).

Yep. I was thinking about retrieving the value of the make -j argument
somehow, but this is not possible and we certainly do not want to
implement the jobserver protocol in shell :-). So using the number of
processors is a sensible choice. What can be done is to detect whether
the -j option is in MAKEFLAGS and only then use multiple instances.

Michal


\
 
 \ /
  Last update: 2015-04-28 12:21    [W:0.038 / U:2.172 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site