* [PATCH RESEND 0/2] make deb-pkg build speed improvements
@ 2015-05-11 14:02 Chris J Arges
2015-05-11 14:02 ` [PATCH 1/2] package: Makefile: ensure $MAKE can use jobserver Chris J Arges
2015-05-11 14:02 ` [PATCH 2/2] builddeb: parallelize debug module installation Chris J Arges
0 siblings, 2 replies; 7+ messages in thread
From: Chris J Arges @ 2015-05-11 14:02 UTC (permalink / raw)
To: mmarek; +Cc: riku.voipio, linux-kbuild, linux-kernel
These two patches should speed up the make deb-pkg build process by utilizing
the make jobserver properly, and using 'find | xargs' to parallelize debug
module installation.
I've tested with the resulting packages to ensure the symbols work as intended
by crash dumping a machine and using the dbg package symbols.
Using an Ubuntu distro conf + make olddefconfig on a 56-core machine, I can see
the following improvements (make clean && make deb-pkg -j`nproc`):
* Before
real 40m56.240s
user 182m17.292s
sys 140m18.812s
* After
real 36m22.633s
user 182m28.028s
sys 148m17.724s
Original submission: https://lkml.org/lkml/2015/4/24/617
Chris J Arges (2):
package: Makefile: ensure $MAKE can use jobserver
builddeb: parallelize debug module installation
scripts/package/Makefile | 2 +-
scripts/package/builddeb | 19 ++++++++++++-------
2 files changed, 13 insertions(+), 8 deletions(-)
--
1.9.1
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 1/2] package: Makefile: ensure $MAKE can use jobserver
2015-05-11 14:02 [PATCH RESEND 0/2] make deb-pkg build speed improvements Chris J Arges
@ 2015-05-11 14:02 ` Chris J Arges
2015-05-29 4:56 ` Riku Voipio
2015-05-11 14:02 ` [PATCH 2/2] builddeb: parallelize debug module installation Chris J Arges
1 sibling, 1 reply; 7+ messages in thread
From: Chris J Arges @ 2015-05-11 14:02 UTC (permalink / raw)
To: mmarek; +Cc: riku.voipio, linux-kbuild, linux-kernel
When using make deb-pkg, builddeb is called without proper MAKEFLAGS due to the
script being invoked without '+'. This results in the following message when
building:
warning: jobserver unavailable: using -j1. Add `+' to parent make rule
Add the '+' so the make operations can be parallelized.
Signed-off-by: Chris J Arges <chris.j.arges@canonical.com>
---
scripts/package/Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/package/Makefile b/scripts/package/Makefile
index 99ca6e7..0dbfae7 100644
--- a/scripts/package/Makefile
+++ b/scripts/package/Makefile
@@ -88,7 +88,7 @@ quiet_cmd_builddeb = BUILDDEB
deb-pkg: FORCE
$(MAKE) KBUILD_SRC=
- $(call cmd,builddeb)
+ +$(call cmd,builddeb)
clean-dirs += $(objtree)/debian/
--
1.9.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 2/2] builddeb: parallelize debug module installation
2015-05-11 14:02 [PATCH RESEND 0/2] make deb-pkg build speed improvements Chris J Arges
2015-05-11 14:02 ` [PATCH 1/2] package: Makefile: ensure $MAKE can use jobserver Chris J Arges
@ 2015-05-11 14:02 ` Chris J Arges
1 sibling, 0 replies; 7+ messages in thread
From: Chris J Arges @ 2015-05-11 14:02 UTC (permalink / raw)
To: mmarek; +Cc: riku.voipio, linux-kbuild, linux-kernel
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, check if the user has requested a parallel build with make. If so,
add the appropriate flags to xargs to set MAXPROCS (-P) equal to the number of
processing units on the system.
Signed-off-by: Chris J Arges <chris.j.arges@canonical.com>
---
scripts/package/builddeb | 19 ++++++++++++-------
1 file changed, 12 insertions(+), 7 deletions(-)
diff --git a/scripts/package/builddeb b/scripts/package/builddeb
index 88dbf23..5849f0c 100755
--- a/scripts/package/builddeb
+++ b/scripts/package/builddeb
@@ -152,16 +152,21 @@ 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)
+ # If we've invoked make with -j, then parallelize; otherwise
+ # just use a single process.
+ procs=1
+ test "${MAKEFLAGS#*-j}" != "${MAKEFLAGS}" && procs=`getconf _NPROCESSORS_ONLN`
+ find $tmpdir/lib/modules/ -name *.ko -printf '%P\n' | xargs -n1 -P${procs} -I {} sh -c '
+ 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
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] package: Makefile: ensure $MAKE can use jobserver
2015-05-11 14:02 ` [PATCH 1/2] package: Makefile: ensure $MAKE can use jobserver Chris J Arges
@ 2015-05-29 4:56 ` Riku Voipio
2015-05-29 20:08 ` [PATCH v2] " Chris J Arges
0 siblings, 1 reply; 7+ messages in thread
From: Riku Voipio @ 2015-05-29 4:56 UTC (permalink / raw)
To: Chris J Arges; +Cc: mmarek, linux-kbuild, linux-kernel
Hi,
On 11 May 2015 at 17:02, Chris J Arges <chris.j.arges@canonical.com> wrote:
> When using make deb-pkg, builddeb is called without proper MAKEFLAGS due to the
> script being invoked without '+'. This results in the following message when
> building:
> warning: jobserver unavailable: using -j1. Add `+' to parent make rule
>
> Add the '+' so the make operations can be parallelized.
>
> Signed-off-by: Chris J Arges <chris.j.arges@canonical.com>
Conflicts with my "add source package" patch now that it adds the
bindeb-pkg target. This patch is still correct, and manually updating
either your or my patch to apply after the other is quite trivial.
Reviewed-by: Riku Voipio <riku.voipio@linaro.org>
> ---
> scripts/package/Makefile | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/scripts/package/Makefile b/scripts/package/Makefile
> index 99ca6e7..0dbfae7 100644
> --- a/scripts/package/Makefile
> +++ b/scripts/package/Makefile
> @@ -88,7 +88,7 @@ quiet_cmd_builddeb = BUILDDEB
>
> deb-pkg: FORCE
> $(MAKE) KBUILD_SRC=
> - $(call cmd,builddeb)
> + +$(call cmd,builddeb)
>
> clean-dirs += $(objtree)/debian/
>
> --
> 1.9.1
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v2] package: Makefile: ensure $MAKE can use jobserver
2015-05-29 4:56 ` Riku Voipio
@ 2015-05-29 20:08 ` Chris J Arges
0 siblings, 0 replies; 7+ messages in thread
From: Chris J Arges @ 2015-05-29 20:08 UTC (permalink / raw)
To: mmarek; +Cc: riku.voipio, linux-kbuild, linux-kernel
When using make deb-pkg, builddeb is called without proper MAKEFLAGS due to the
script being invoked without '+'. This results in the following message when
building:
warning: jobserver unavailable: using -j1. Add `+' to parent make rule
Add the '+' so the make operations can be parallelized.
Signed-off-by: Chris J Arges <chris.j.arges@canonical.com>
---
scripts/package/Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/package/Makefile b/scripts/package/Makefile
index bc6aa00..ea2a405 100644
--- a/scripts/package/Makefile
+++ b/scripts/package/Makefile
@@ -97,7 +97,7 @@ quiet_cmd_builddeb = BUILDDEB
deb-pkg: FORCE
$(MAKE) KBUILD_SRC=
- $(call cmd,builddeb)
+ +$(call cmd,builddeb)
clean-dirs += $(objtree)/debian/
--
1.9.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] package: Makefile: ensure $MAKE can use jobserver
2015-04-24 18:25 ` [PATCH 1/2] package: Makefile: ensure $MAKE can use jobserver Chris J Arges
@ 2015-04-28 8:38 ` Riku Voipio
0 siblings, 0 replies; 7+ messages in thread
From: Riku Voipio @ 2015-04-28 8:38 UTC (permalink / raw)
To: Chris J Arges; +Cc: linux-kbuild, mmarek, linux-kernel
On 24 April 2015 at 21:25, Chris J Arges <chris.j.arges@canonical.com> wrote:
> When using make deb-pkg, builddeb is called without proper MAKEFLAGS due to the
> script being invoked without '+'. This results in the following message when
> building:
> warning: jobserver unavailable: using -j1. Add `+' to parent make rule
>
> Add the '+' so the make operations can be parallelized.
Looks good, and works fine in my tests.
Reviewed-by: Riku Voipio <riku.voipio@linaro.org>
> Signed-off-by: Chris J Arges <chris.j.arges@canonical.com>
> ---
> scripts/package/Makefile | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/scripts/package/Makefile b/scripts/package/Makefile
> index 99ca6e7..0dbfae7 100644
> --- a/scripts/package/Makefile
> +++ b/scripts/package/Makefile
> @@ -88,7 +88,7 @@ quiet_cmd_builddeb = BUILDDEB
>
> deb-pkg: FORCE
> $(MAKE) KBUILD_SRC=
> - $(call cmd,builddeb)
> + +$(call cmd,builddeb)
>
> clean-dirs += $(objtree)/debian/
>
> --
> 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
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 1/2] package: Makefile: ensure $MAKE can use jobserver
2015-04-24 18:25 [PATCH 0/2] make deb-pkg build speed improvements Chris J Arges
@ 2015-04-24 18:25 ` Chris J Arges
2015-04-28 8:38 ` Riku Voipio
0 siblings, 1 reply; 7+ messages in thread
From: Chris J Arges @ 2015-04-24 18:25 UTC (permalink / raw)
To: linux-kbuild, mmarek; +Cc: linux-kernel, Chris J Arges
When using make deb-pkg, builddeb is called without proper MAKEFLAGS due to the
script being invoked without '+'. This results in the following message when
building:
warning: jobserver unavailable: using -j1. Add `+' to parent make rule
Add the '+' so the make operations can be parallelized.
Signed-off-by: Chris J Arges <chris.j.arges@canonical.com>
---
scripts/package/Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/package/Makefile b/scripts/package/Makefile
index 99ca6e7..0dbfae7 100644
--- a/scripts/package/Makefile
+++ b/scripts/package/Makefile
@@ -88,7 +88,7 @@ quiet_cmd_builddeb = BUILDDEB
deb-pkg: FORCE
$(MAKE) KBUILD_SRC=
- $(call cmd,builddeb)
+ +$(call cmd,builddeb)
clean-dirs += $(objtree)/debian/
--
1.9.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
end of thread, other threads:[~2015-05-29 20:09 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-11 14:02 [PATCH RESEND 0/2] make deb-pkg build speed improvements Chris J Arges
2015-05-11 14:02 ` [PATCH 1/2] package: Makefile: ensure $MAKE can use jobserver Chris J Arges
2015-05-29 4:56 ` Riku Voipio
2015-05-29 20:08 ` [PATCH v2] " Chris J Arges
2015-05-11 14:02 ` [PATCH 2/2] builddeb: parallelize debug module installation Chris J Arges
-- strict thread matches above, loose matches on Subject: below --
2015-04-24 18:25 [PATCH 0/2] make deb-pkg build speed improvements Chris J Arges
2015-04-24 18:25 ` [PATCH 1/2] package: Makefile: ensure $MAKE can use jobserver Chris J Arges
2015-04-28 8:38 ` Riku Voipio
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).