Skip to content

Commit

Permalink
kbuild: reduce the number of mkdir calls during modules_install
Browse files Browse the repository at this point in the history
Calling 'mkdir' for every module results in redundant syscalls.

Use $(sort ...) to drop the duplicated directories.

Signed-off-by: Masahiro Yamada <[email protected]>
Reviewed-by: Nicolas Schier <[email protected]>
  • Loading branch information
masahir0y committed Sep 1, 2023
1 parent d8131c2 commit 2dfec88
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion scripts/Makefile.modinst
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ __modinst:
include include/config/auto.conf
include $(srctree)/scripts/Kbuild.include

install-y :=

modules := $(call read-file, $(MODORDER))

ifeq ($(KBUILD_EXTMOD),)
Expand All @@ -27,6 +29,7 @@ suffix-$(CONFIG_MODULE_COMPRESS_XZ) := .xz
suffix-$(CONFIG_MODULE_COMPRESS_ZSTD) := .zst

modules := $(patsubst $(extmod_prefix)%.o, $(dst)/%.ko$(suffix-y), $(modules))
install-$(CONFIG_MODULES) += $(modules)

__modinst: $(modules)
@:
Expand All @@ -35,7 +38,7 @@ __modinst: $(modules)
# Installation
#
quiet_cmd_install = INSTALL $@
cmd_install = mkdir -p $(dir $@); cp $< $@
cmd_install = cp $< $@

# Strip
#
Expand Down Expand Up @@ -81,6 +84,9 @@ endif

ifeq ($(modules_sign_only),)

# Create necessary directories
$(shell mkdir -p $(sort $(dir $(install-y))))

$(dst)/%.ko: $(extmod_prefix)%.ko FORCE
$(call cmd,install)
$(call cmd,strip)
Expand Down

0 comments on commit 2dfec88

Please sign in to comment.