[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230823115048.823011-5-masahiroy@kernel.org>
Date: Wed, 23 Aug 2023 20:50:45 +0900
From: Masahiro Yamada <masahiroy@...nel.org>
To: linux-kbuild@...r.kernel.org
Cc: linux-kernel@...r.kernel.org,
Masahiro Yamada <masahiroy@...nel.org>,
Nathan Chancellor <nathan@...nel.org>,
Nick Desaulniers <ndesaulniers@...gle.com>,
Nicolas Schier <nicolas@...sle.eu>
Subject: [PATCH 5/8] kbuild: reduce the number of mkdir calls during modules_install
Calling 'mkdir' for every module results in redundant syscalls.
Use $(sort ...) to drop the duplicated directories.
Signed-off-by: Masahiro Yamada <masahiroy@...nel.org>
---
scripts/Makefile.modinst | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/scripts/Makefile.modinst b/scripts/Makefile.modinst
index 7a64ece9b826..5d687a453d90 100644
--- a/scripts/Makefile.modinst
+++ b/scripts/Makefile.modinst
@@ -9,6 +9,13 @@ __modinst:
include include/config/auto.conf
include $(srctree)/scripts/Kbuild.include
+install-y :=
+
+PHONY += prepare
+
+prepare:
+ $(Q)mkdir -p $(sort $(dir $(install-y)))
+
modules := $(call read-file, $(MODORDER))
ifeq ($(KBUILD_EXTMOD),)
@@ -27,6 +34,7 @@ suffix-$(CONFIG_MODULE_COMPRESS_XZ) := .xz
suffix-$(CONFIG_MODULE_COMPRESS_ZSTD) := .zst
modules := $(patsubst $(extmod_prefix)%.o, $(dst)/%.ko$(suffix-y), $(modules))
+install-y += $(modules)
__modinst: $(modules)
@:
@@ -35,7 +43,7 @@ __modinst: $(modules)
# Installation
#
quiet_cmd_install = INSTALL $@
- cmd_install = mkdir -p $(dir $@); cp $< $@
+ cmd_install = cp $< $@
# Strip
#
@@ -95,6 +103,8 @@ depmod: $(modules)
quiet_cmd_depmod = DEPMOD $(MODLIB)
cmd_depmod = $(srctree)/scripts/depmod.sh $(KERNELRELEASE)
+$(install-y): prepare
+
else
$(dst)/%.ko: FORCE
--
2.39.2
Powered by blists - more mailing lists