Re: [PATCH 5/8] kbuild: reduce the number of mkdir calls during modules_install

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Aug 23, 2023 at 08:50:45PM +0900 Masahiro Yamada wrote:
> Calling 'mkdir' for every module results in redundant syscalls.
> 
> Use $(sort ...) to drop the duplicated directories.
> 
> Signed-off-by: Masahiro Yamada <masahiroy@xxxxxxxxxx>
> ---
> 
>  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

Reviewed-by: Nicolas Schier <nicolas@xxxxxxxxx>

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Linux&nblp;USB Development]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite Secrets]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux