From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 1E89358973 for ; Sun, 24 Jan 2016 05:50:21 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 225C021C00A; Sun, 24 Jan 2016 05:50:19 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 9F67B21C00A for ; Sun, 24 Jan 2016 05:50:17 +0000 (UTC) Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 747C03408F0 for ; Sun, 24 Jan 2016 05:50:16 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 00FFC1017 for ; Sun, 24 Jan 2016 05:50:14 +0000 (UTC) From: "Robin H. Johnson" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Robin H. Johnson" Message-ID: <1453614553.92cb275526ce94fb6118cb715622b4dd9a136444.robbat2@gentoo> Subject: [gentoo-commits] proj/genkernel:master commit in: /, doc/ X-VCS-Repository: proj/genkernel X-VCS-Files: doc/genkernel.8.txt gen_cmdline.sh gen_compile.sh gen_determineargs.sh genkernel.conf X-VCS-Directories: / doc/ X-VCS-Committer: robbat2 X-VCS-Committer-Name: Robin H. Johnson X-VCS-Revision: 92cb275526ce94fb6118cb715622b4dd9a136444 X-VCS-Branch: master Date: Sun, 24 Jan 2016 05:50:14 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: c03105f6-437c-4354-85b4-a449968f6f29 X-Archives-Hash: eea45e5619dfb3804315c2c3dcb1a1a3 commit: 92cb275526ce94fb6118cb715622b4dd9a136444 Author: Robin H. Johnson gentoo org> AuthorDate: Sun Jan 24 05:49:13 2016 +0000 Commit: Robin H. Johnson gentoo org> CommitDate: Sun Jan 24 05:49:13 2016 +0000 URL: https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=92cb2755 Support nice(1) to affect the scheduling of the make invocations. Signed-off-by: Robin H. Johnson gentoo.org> doc/genkernel.8.txt | 3 +++ gen_cmdline.sh | 20 ++++++++++++++++++++ gen_compile.sh | 19 +++++++++++++------ gen_determineargs.sh | 1 + genkernel.conf | 3 +++ 5 files changed, 40 insertions(+), 6 deletions(-) diff --git a/doc/genkernel.8.txt b/doc/genkernel.8.txt index 45af60e..ef0aa1e 100644 --- a/doc/genkernel.8.txt +++ b/doc/genkernel.8.txt @@ -233,6 +233,9 @@ LOW-LEVEL COMPILATION OPTIONS *--makeopts*=:: GNU Make options such as -j2, etc. +*--*[*no-*]*nice*[=]:: + Runs the kernel make at the default niceness (reduction in priority) of + 10, or in the case of --no-nice, runs the kernel make at normal priority. INITIALIZATION ~~~~~~~~~~~~~~ diff --git a/gen_cmdline.sh b/gen_cmdline.sh index c4f027a..01adfdd 100755 --- a/gen_cmdline.sh +++ b/gen_cmdline.sh @@ -80,6 +80,9 @@ longusage() { echo " --no-mountboot Don't mount BOOTDIR automatically" echo " --bootdir= Set the location of the boot-directory, default is /boot" echo " --modprobedir= Set the location of the modprobe.d-directory, default is /etc/modprobe.d" + echo " --nice Run the kernel make at the default nice level (10)." + echo " --nice=<0-19> Run the kernel make at the selected nice level." + echo " --no-nice Don't be nice while running the kernel make." echo " Initialization" echo " --splash= Enable framebuffer splash using " echo " --splash-res= Select splash theme resolutions to install" @@ -598,6 +601,23 @@ parse_cmdline() { --config=*) print_info 2 "CMD_GK_CONFIG: `parse_opt "$*"`" ;; + --nice) + CMD_NICE=10 + print_info 2 "CMD_NICE: ${CMD_NICE}" + ;; + --nice=*) + CMD_NICE=`parse_opt "$*"` + if [ ${CMD_NICE} -lt 0 -o ${CMD_NICE} -gt 19 ] + then + echo "Error: Illegal value specified for --nice= parameter." + exit 1 + fi + print_info 2 "CMD_NICE: ${CMD_NICE}" + ;; + --no-nice) + CMD_NICE=0 + print_info 2 "CMD_NICE: ${CMD_NICE}" + ;; all) BUILD_KERNEL=1 BUILD_MODULES=1 diff --git a/gen_compile.sh b/gen_compile.sh index 99cf37c..c26a652 100755 --- a/gen_compile.sh +++ b/gen_compile.sh @@ -261,25 +261,32 @@ compile_generic() { esac shift 2 + if [ ${NICE} -ne 0 ] + then + NICEOPTS="nice -n${NICE} " + else + NICEOPTS="" + fi + # the eval usage is needed in the next set of code # as ARGS can contain spaces and quotes, eg: # ARGS='CC="ccache gcc"' if [ "${argstype}" == 'kernelruntask' ] then # Silent operation, forced -j1 - print_info 2 "COMMAND: ${MAKE} ${MAKEOPTS} -j1 ${ARGS} ${target} $*" 1 0 1 - eval ${MAKE} -s ${MAKEOPTS} -j1 "${ARGS}" ${target} $* + print_info 2 "COMMAND: ${NICEOPTS}${MAKE} ${MAKEOPTS} -j1 ${ARGS} ${target} $*" 1 0 1 + eval ${NICEOPTS}${MAKE} -s ${MAKEOPTS} -j1 "${ARGS}" ${target} $* RET=$? elif [ "${LOGLEVEL}" -gt "1" ] then # Output to stdout and logfile - print_info 2 "COMMAND: ${MAKE} ${MAKEOPTS} ${ARGS} ${target} $*" 1 0 1 - eval ${MAKE} ${MAKEOPTS} ${ARGS} ${target} $* 2>&1 | tee -a ${LOGFILE} + print_info 2 "COMMAND: ${NICEOPTS}${MAKE} ${MAKEOPTS} ${ARGS} ${target} $*" 1 0 1 + eval ${NICEOPTS}${MAKE} ${MAKEOPTS} ${ARGS} ${target} $* 2>&1 | tee -a ${LOGFILE} RET=${PIPESTATUS[0]} else # Output to logfile only - print_info 2 "COMMAND: ${MAKE} ${MAKEOPTS} ${ARGS} ${target} $*" 1 0 1 - eval ${MAKE} ${MAKEOPTS} ${ARGS} ${target} $* >> ${LOGFILE} 2>&1 + print_info 2 "COMMAND: ${NICEOPTS}${MAKE} ${MAKEOPTS} ${ARGS} ${target} $*" 1 0 1 + eval ${NICEOPTS}${MAKE} ${MAKEOPTS} ${ARGS} ${target} $* >> ${LOGFILE} 2>&1 RET=$? fi [ ${RET} -ne 0 ] && diff --git a/gen_determineargs.sh b/gen_determineargs.sh index cbc88ba..522996d 100755 --- a/gen_determineargs.sh +++ b/gen_determineargs.sh @@ -78,6 +78,7 @@ determine_real_args() { set_config_with_override STRING COMPRESS_INITRD CMD_COMPRESS_INITRD "$DEFAULT_COMPRESS_INITRD" set_config_with_override STRING COMPRESS_INITRD_TYPE CMD_COMPRESS_INITRD_TYPE "$DEFAULT_COMPRESS_INITRD_TYPE" set_config_with_override STRING MAKEOPTS CMD_MAKEOPTS "$DEFAULT_MAKEOPTS" + set_config_with_override STRING NICE CMD_NICE "10" set_config_with_override STRING KERNEL_MAKE CMD_KERNEL_MAKE "$DEFAULT_KERNEL_MAKE" set_config_with_override STRING UTILS_MAKE CMD_UTILS_MAKE "$DEFAULT_UTILS_MAKE" set_config_with_override STRING KERNEL_CC CMD_KERNEL_CC "$DEFAULT_KERNEL_CC" diff --git a/genkernel.conf b/genkernel.conf index 2e38e41..6b974e1 100644 --- a/genkernel.conf +++ b/genkernel.conf @@ -55,6 +55,9 @@ USECOLOR="yes" # argument is: *+1 #MAKEOPTS="$(portageq envvar MAKEOPTS)" +# Run the kernel make at the following NICE level. Default is 10. +# NICE=10 + # Add in LVM support from static binaries if they exist on the system, or # compile static LVM binaries if static ones do not exist. #LVM="no"