All of lore.kernel.org
 help / color / mirror / Atom feed
* [LTP] [PATCH v3 0/3] Speedup LTP compile time by ~20% on multi-machine
@ 2026-10-21  8:11 Andrea Cervesato
  2026-10-21  8:11 ` [LTP] [PATCH v3 1/3] build: Fix library prerequisites in testcases.mk Andrea Cervesato
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Andrea Cervesato @ 2026-10-21  8:11 UTC (permalink / raw)
  To: Linux Test Project

The following results show how this optimization moves compile times
really far from what we have now. With a single threaded build, LTP
would take approximately 12 minutes to compile. With a multi-threaded
build on 16 CPUs, this drops down to ~46 seconds.

time make -j16

Executed in   45.96 secs    fish           external
   usr time  519.11 secs    0.24 millis  519.11 secs
   sys time  167.13 secs    1.08 millis  167.13 secs

Signed-off-by: Andrea Cervesato <andrea.cervesato@suse.com>
---
Changes in v3:
- added libs-all ordering to avoid races
- Link to v2: https://lore.kernel.org/20261020-build_system_optimize-v2-0-b527ac7cf835@suse.com

Changes in v2:
- fix build race condition
- Link to v1: https://lore.kernel.org/20261020-build_system_optimize-v1-1-744f9fa88908@suse.com

---
Andrea Cervesato (3):
      build: Fix library prerequisites in testcases.mk
      build: Build shared libs once on subtree make
      build: Parallelize subdirectory recursion in generic_trunk_target

 Makefile                            |  2 ++
 include/mk/generic_trunk_target.inc | 58 ++++++++++++++++++++++++++++++++-----
 include/mk/testcases.mk             | 14 +++++----
 testcases/kernel/Makefile           |  3 ++
 testcases/kernel/include/lib.mk     |  4 +--
 testcases/network/rpc/Makefile      |  3 ++
 6 files changed, 69 insertions(+), 15 deletions(-)
---
base-commit: 121876b3da3ff59b0dd17b4798b2e4699ba431d1
change-id: 20261020-build_system_optimize-6cd0343f08e1

Best regards,
--  
Andrea Cervesato <andrea.cervesato@suse.com>


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 7+ messages in thread
* [LTP] [PATCH v2 1/3] build: Fix library prerequisites in testcases.mk
@ 2026-10-20 16:42 Andrea Cervesato
  2026-10-20 19:04 ` [LTP] " linuxtestproject.agent
  0 siblings, 1 reply; 7+ messages in thread
From: Andrea Cervesato @ 2026-10-20 16:42 UTC (permalink / raw)
  To: Linux Test Project

From: Andrea Cervesato <andrea.cervesato@suse.com>

Fix LTPLIBS_FILES to match the actual libltp<name>.a archive names and
only mark them .PHONY when MAKELEVEL == 0 so recursive leaf sub-makes
do not redundantly rebuild them in parallel.

Also make directory prerequisites order-only so directory mtime updates
do not trigger unnecessary archive rebuilds.

Signed-off-by: Andrea Cervesato <andrea.cervesato@suse.com>
---
 include/mk/testcases.mk         | 14 ++++++++------
 testcases/kernel/include/lib.mk |  4 ++--
 2 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/include/mk/testcases.mk b/include/mk/testcases.mk
index 2609535ce..5960d7485 100644
--- a/include/mk/testcases.mk
+++ b/include/mk/testcases.mk
@@ -12,11 +12,11 @@ LIBLTP_DIR	:= $(abs_top_builddir)/lib
 
 LIBLTP		:= $(LIBLTP_DIR)/libltp.a
 
-$(APICMDS_DIR)/tst_kvercmp: $(APICMDS_DIR)
-	$(MAKE) -C "$^" -f "$(abs_top_srcdir)/tools/apicmds/Makefile" all
+$(APICMDS_DIR)/tst_kvercmp: | $(APICMDS_DIR)
+	$(MAKE) -C "$(APICMDS_DIR)" -f "$(abs_top_srcdir)/tools/apicmds/Makefile" all
 
-$(LIBLTP): $(LIBLTP_DIR)
-	$(MAKE) -C "$^" -f "$(abs_top_srcdir)/lib/Makefile" all
+$(LIBLTP): | $(LIBLTP_DIR)
+	$(MAKE) -C "$(LIBLTP_DIR)" -f "$(abs_top_srcdir)/lib/Makefile" all
 
 MAKE_DEPS	:= $(LIBLTP)
 
@@ -27,13 +27,15 @@ LDLIBS		+= -lltp
 ifdef LTPLIBS
 
 LTPLIBS_DIRS = $(addprefix $(abs_top_builddir)/libs/, $(LTPLIBS))
-LTPLIBS_FILES = $(addsuffix .a, $(addprefix $(abs_top_builddir)/libs/, $(foreach LIB,$(LTPLIBS),$(LIB)/lib$(LIB))))
+LTPLIBS_FILES = $(addsuffix .a, $(addprefix $(abs_top_builddir)/libs/, $(foreach LIB,$(LTPLIBS),$(LIB)/libltp$(LIB))))
 
 MAKE_DEPS += $(LTPLIBS_FILES)
 
+ifeq ($(MAKELEVEL),0)
 .PHONY: $(LTPLIBS_FILES)
+endif
 
-$(LTPLIBS_FILES): $(LTPLIBS_DIRS)
+$(LTPLIBS_FILES): | $(LTPLIBS_DIRS)
 
 $(LTPLIBS_FILES): %:
 ifdef VERBOSE
diff --git a/testcases/kernel/include/lib.mk b/testcases/kernel/include/lib.mk
index 40a09b77e..c1a0c6d52 100644
--- a/testcases/kernel/include/lib.mk
+++ b/testcases/kernel/include/lib.mk
@@ -29,8 +29,8 @@ LDFLAGS			+= -L$(LIBKERNTEST_DIR)
 $(LIBKERNTEST_DIR):
 	mkdir -p "$@"
 
-$(LIBKERNTEST): $(LIBKERNTEST_DIR)
-	$(MAKE) -C $^ -f "$(LIBKERNTEST_SRCDIR)/Makefile" all
+$(LIBKERNTEST): | $(LIBKERNTEST_DIR)
+	$(MAKE) -C "$(LIBKERNTEST_DIR)" -f "$(LIBKERNTEST_SRCDIR)/Makefile" all
 
 MAKE_DEPS		+= $(LIBKERNTEST)
 

-- 
2.51.0


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2026-10-21 13:41 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-21  8:11 [LTP] [PATCH v3 0/3] Speedup LTP compile time by ~20% on multi-machine Andrea Cervesato
2026-10-21  8:11 ` [LTP] [PATCH v3 1/3] build: Fix library prerequisites in testcases.mk Andrea Cervesato
2026-10-21 13:40   ` [LTP] " linuxtestproject.agent
2026-10-21  8:11 ` [LTP] [PATCH v3 2/3] build: Build shared libs once on subtree make Andrea Cervesato
2026-10-21  8:11 ` [LTP] [PATCH v3 3/3] build: Parallelize subdirectory recursion in generic_trunk_target Andrea Cervesato
  -- strict thread matches above, loose matches on Subject: below --
2026-10-20 16:42 [LTP] [PATCH v2 1/3] build: Fix library prerequisites in testcases.mk Andrea Cervesato
2026-10-20 19:04 ` [LTP] " linuxtestproject.agent
2026-10-21  8:06   ` Andrea Cervesato via ltp

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.