linux-kbuild.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Nicolas Schier <nicolas@fjasle.eu>
To: Masahiro Yamada <masahiroy@kernel.org>
Cc: linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org,
	Nathan Chancellor <nathan@kernel.org>,
	Nick Desaulniers <ndesaulniers@google.com>
Subject: Re: [PATCH 5/8] kbuild: reduce the number of mkdir calls during modules_install
Date: Wed, 23 Aug 2023 22:22:03 +0200	[thread overview]
Message-ID: <ZOZqa8mk+4uKY87f@fjasle.eu> (raw)
In-Reply-To: <20230823115048.823011-5-masahiroy@kernel.org>

[-- Attachment #1: Type: text/plain, Size: 1629 bytes --]

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@kernel.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

Reviewed-by: Nicolas Schier <nicolas@fjasle.eu>

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2023-08-23 20:23 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-23 11:50 [PATCH 1/8] kbuild: do not run depmod for 'make modules_sign' Masahiro Yamada
2023-08-23 11:50 ` [PATCH 2/8] kbuild: add modules_sign to no-{compiler,sync-config}-targets Masahiro Yamada
2023-08-23 19:53   ` Nicolas Schier
2023-08-23 11:50 ` [PATCH 3/8] kbuild: move depmod rule to scripts/Makefile.modinst Masahiro Yamada
2023-08-23 19:53   ` Nicolas Schier
2023-08-26 13:50     ` Masahiro Yamada
2023-08-23 11:50 ` [PATCH 4/8] kbuild: remove $(MODLIB)/source symlink Masahiro Yamada
2023-08-23 20:17   ` Nicolas Schier
2023-08-23 11:50 ` [PATCH 5/8] kbuild: reduce the number of mkdir calls during modules_install Masahiro Yamada
2023-08-23 20:22   ` Nicolas Schier [this message]
2023-08-23 11:50 ` [PATCH 6/8] kbuild: move more module installation code to scripts/Makefile.modinst Masahiro Yamada
2023-08-28 14:25   ` Nicolas Schier
2023-08-29  2:35     ` Masahiro Yamada
2023-08-29  3:50       ` Nicolas Schier
2023-08-23 11:50 ` [PATCH 7/8] kbuild: support 'make modules_sign' with CONFIG_MODULE_SIG_ALL=n Masahiro Yamada
2023-08-28 14:31   ` Nicolas Schier
2023-08-23 11:50 ` [PATCH 8/8] kbuild: support modules_sign for external modules as well Masahiro Yamada
2023-08-28 14:52   ` Nicolas Schier
2023-08-23 19:52 ` [PATCH 1/8] kbuild: do not run depmod for 'make modules_sign' Nicolas Schier
2023-08-26 13:36   ` Masahiro Yamada

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZOZqa8mk+4uKY87f@fjasle.eu \
    --to=nicolas@fjasle.eu \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=masahiroy@kernel.org \
    --cc=nathan@kernel.org \
    --cc=ndesaulniers@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).