Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
make's --load-average not honored?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Portage & Programming
View previous topic :: View next topic  
Author Message
Zucca
Moderator
Moderator


Joined: 14 Jun 2007
Posts: 3689
Location: Rasi, Finland

PostPosted: Tue Sep 19, 2023 5:12 pm    Post subject: make's --load-average not honored? Reply with quote

So. I had set MAKEOPTS="--jobs=8 --load-average=7.80" and Portage was compiling nodejs and rust at the same time (checked that via qlop -r). But still my load average was 16.00.

I went to investigate this a bit and saw that rust didn't use make but nodejs did. I would then assume the nodejs compiling process to slow down (to halt basically) because the rust compiling process would create a load of around 8.

I'm certain that before --load-average has been honored. But for some moths, at least, this hasn't been the case, I think. The last @world update really caught my eye at load average.

I've now loosened my MAKEOPTS (to avoid such high loads) and it won't match what I stated at the beginning. Otherwise the following output is the same.
emerge --info:
Portage 3.0.49 (python 3.11.5-final-0, default/linux/amd64/17.1/no-multilib, gcc-12, glibc-2.37-r3, 6.1.46-NBLK-WAX9X x86_64)
=================================================================
System uname: Linux-6.1.46-NBLK-WAX9X-x86_64-AMD_Ryzen_5_3500U_with_Radeon_Vega_Mobile_Gfx-with-glibc2.37
KiB Mem:     7027680 total,   4420124 free
KiB Swap:   28327928 total,  28221996 free
Timestamp of repository mv: Thu, 14 Sep 2023 05:49:11 +0000
Head commit of repository mv: f53913753d118ad4cf05f8a530410a276fb34c65

Head commit of repository trinity-official: 5d90434b7ceda6526001d0e6117b1cb61e229c84

Timestamp of repository gentoo: Tue, 19 Sep 2023 09:30:01 +0000
Head commit of repository gentoo: 85ddb690a3981c92199239c64a2200849c869f0c
Timestamp of repository guru: Tue, 19 Sep 2023 06:31:33 +0000
Head commit of repository guru: 7b34d26e9de045797f27bad67e5caf7e6627d673

Head commit of repository zucca: 6cc42ddbe8cb8b12ba1598a82998695a59288480

sh bash 5.1_p16-r6
ld GNU ld (Gentoo 2.40 p5) 2.40.0
app-misc/pax-utils:        1.3.5::gentoo
app-shells/bash:           5.1_p16-r6::gentoo
dev-lang/perl:             5.38.0-r1::gentoo
dev-lang/python:           3.11.5::gentoo
dev-lang/rust:             1.71.1::gentoo
dev-util/cmake:            3.26.5-r2::gentoo
dev-util/meson:            1.1.1::gentoo
sys-apps/baselayout:       2.14::gentoo
sys-apps/openrc:           0.48::gentoo
sys-apps/sandbox:          2.37::gentoo
sys-devel/autoconf:        2.13-r7::gentoo, 2.71-r6::gentoo
sys-devel/automake:        1.16.5-r1::gentoo
sys-devel/binutils:        2.40-r5::gentoo
sys-devel/binutils-config: 5.5::gentoo
sys-devel/clang:           16.0.6::gentoo
sys-devel/gcc:             12.3.1_p20230526::gentoo
sys-devel/gcc-config:      2.11::gentoo
sys-devel/libtool:         2.4.7-r1::gentoo
sys-devel/llvm:            16.0.6::gentoo
sys-devel/make:            4.4.1-r1::gentoo
sys-kernel/linux-headers:  6.1::gentoo (virtual/os-headers)
sys-libs/glibc:            2.37-r3::gentoo
Repositories:

mv
    location: /var/db/repos/mv
    sync-type: git
    sync-uri: https://github.com/gentoo-mirror/mv.git
    masters: gentoo
    priority: -101
    volatile: False

trinity-official
    location: /var/db/repos/trinity-official
    sync-type: git
    sync-uri: https://mirror.git.trinitydesktop.org/gitea/TDE/tde-packaging-gentoo.git
    masters: gentoo
    priority: -100
    volatile: False

gentoo
    location: /var/db/repos/gentoo
    sync-type: rsync
    sync-uri: rsync://rsync.gentoo.org/gentoo-portage
    priority: 100
    volatile: False
    sync-rsync-verify-max-age: 24
    sync-rsync-verify-jobs: 1
    sync-rsync-verify-metamanifest: yes
    sync-rsync-extra-opts:

guru
    location: /var/db/repos/guru
    sync-type: git
    sync-uri: https://github.com/gentoo-mirror/guru.git
    masters: gentoo
    priority: 2
    volatile: False

zucca
    location: /var/db/repos/zucca
    sync-type: git
    sync-uri: https://github.com/Zuccace/zucca-overlay.git
    masters: gentoo
    priority: 1000
    volatile: False

Installed sets: @boot, @core, @gui, @kernel
ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="@FREE @FREE -@EULA intel-ucode NPSL freedist linux-fw-redistributable no-source-code"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O2 -march=native"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-O2 -march=native"
DISTDIR="/var/cache/distfiles"
EMERGE_DEFAULT_OPTS="--autounmask-keep-masks --nospinner --jobs=8 --load-average=6.8 --keep-going y --deep 10 --with-bdeps y"
ENV_UNSET="CARGO_HOME DBUS_SESSION_BUS_ADDRESS DISPLAY GDK_PIXBUF_MODULE_FILE GOBIN GOPATH PERL5LIB PERL5OPT PERLPREFIX PERL_CORE PERL_MB_OPT PERL_MM_OPT XAUTHORITY XDG_CACHE_HOME XDG_CONFIG_HOME XDG_DATA_HOME XDG_RUNTIME_DIR XDG_STATE_HOME"
FCFLAGS="-O2 -march=native"
FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs binpkg-multi-instance buildpkg-live config-protect-if-modified distlocks ebuild-locks fixlafiles ipc-sandbox merge-sync multilib-strict network-sandbox news parallel-fetch pid-sandbox preserve-libs protect-owned qa-unresolved-soname-deps sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O2 -march=native"
GENTOO_MIRRORS="ftp://ftp.halifax.rwth-aachen.de/gentoo/ ftp://ftp-stud.hs-esslingen.de/pub/Mirrors/gentoo/ ftp://mirror.netcologne.de/gentoo/"
LANG="C.UTF8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
LEX="flex"
MAKEOPTS="--jobs=4 --load-average=7.20"
PKGDIR="/var/cache/binpkgs"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=10 --exclude=/distfiles --exclude=/local --exclude=/packages --exclude=/.git"
PORTAGE_TMPDIR="/var/tmp"
SHELL="/bin/bash"
USE="Xwayland acl alsa amd amd64 amdgpu apng av1 backlight bluetooth bluez bzip2 cairo cli connection-sharing crypt cups dbus device-mapper dng dri dualminer duke3d duktape exif fbcon fbdev ffmpeg firefox flac fortran gdbm git gitstatus gles2 gnome-keyring gtk gtk3 harfbuzz hwaccel icons iconv icu ime inspector ipv6 jpeg libnotify libtirpc lm-sensors lvm lvm2 lxc lzip man matroska mdnsresponder-compat media-extras minizip mkv mp3 mtp ncat ncurses network-map networkmanager nftables nls nping nptl offensive ogg opencl opengl openh264 openmp openrc opus pam pcre pcre16 pipewire png postproc raw readline redistributable rustfmt screenshot scripttools seatd seccomp secure-delete spice split-usr sqlite ssl swiftshader system-act system-av1 system-binutils system-boost system-bootloader system-bootstrap system-cmark system-crontab system-digest system-ffmpeg system-harfbuzz system-icu system-info system-ipxe system-jpeg system-jsoncpp system-lcms system-leveldb system-libcxx system-libevent system-libs system-libsdl2 system-libvpx system-libyaml system-llvm system-lua system-lz4 system-mathjax system-mesa system-mimalloc system-mitkrb5 system-numpy system-png system-python system-python-libs system-qemu system-seabios system-sqlite system-ssl system-tbb system-webp system-wfconfig system-wlroots system-xxhash system-zlib sysv-utils test-rust text theora tif tiff tmpfiles tray udev udisks unicode usb user-session v4l v4l2 v4lutils vorbis vp8 vp9 vpx vulkan wayfire wayland webm webp widgets wifi wlroots x11-backend x264 xattr xwayland zlib zstd" ABI_X86="64" ADA_TARGET="gnat_2021" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="karbon sheets words" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="aes avx avx2 f16c fma3 mmx mmxext pclmul popcnt rdrand sha sse sse2 sse3 sse4_1 sse4_2 sse4a ssse3" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock greis isync itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 timing tsip tripmate tnt ublox ubx" INPUT_DEVICES="libinput" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LUA_SINGLE_TARGET="lua5-1" LUA_TARGETS="lua5-1" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php8-1" POSTGRES_TARGETS="postgres15" PYTHON_SINGLE_TARGET="python3_11" PYTHON_TARGETS="python3_11" RUBY_TARGETS="ruby31" SANE_BACKENDS="pixma" VIDEO_CARDS="amdgpu radeonsi radeon" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq proto steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  ADDR2LINE, AR, ARFLAGS, AS, ASFLAGS, CC, CCLD, CONFIG_SHELL, CPP, CPPFLAGS, CTARGET, CXX, CXXFILT, ELFEDIT, EXTRA_ECONF, F77FLAGS, FC, GCOV, GPROF, INSTALL_MASK, LC_ALL, LD, LFLAGS, LIBTOOL, LINGUAS, MAKE, MAKEFLAGS, NM, OBJCOPY, OBJDUMP, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, RANLIB, READELF, RUSTFLAGS, SIZE, STRINGS, STRIP, YACC, YFLAGS


Have I miscofigured something?
_________________
..: Zucca :..

My gentoo installs:
init=/sbin/openrc-init
-systemd -logind -elogind seatd

Quote:
I am NaN! I am a man!
Back to top
View user's profile Send private message
pingtoo
Veteran
Veteran


Joined: 10 Sep 2021
Posts: 1240
Location: Richmond Hill, Canada

PostPosted: Tue Sep 19, 2023 6:14 pm    Post subject: Reply with quote

May be your are thinking something else.

the MAKEOPTS is only used for per make job, so in your example each of nodejs job and rust job have limit set to concurrently run up to 8 tasks while system load average below 7.8.

So while system load is above 7.8 I think, each make job will not submit more tasks.

May be you are thinking using "EMERGE_DEFAULT_OPTS=--jobs=N --load-average-X.Y". Please see Gentoo wiki EMERGE_DEFAULT_OPTS
Back to top
View user's profile Send private message
Zucca
Moderator
Moderator


Joined: 14 Jun 2007
Posts: 3689
Location: Rasi, Finland

PostPosted: Tue Sep 19, 2023 7:21 pm    Post subject: Reply with quote

pingtoo wrote:
the MAKEOPTS is only used for per make job, so in your example each of nodejs job and rust job have limit set to concurrently run up to 8 tasks while system load average below 7.8.

So while system load is above 7.8 I think, each make job will not submit more tasks.
Yes. That's how it should work. But both (nodejs and rust) package "emerging" processes still spawned 8 compilation processes even when the system load was around 16. Neither never dropped concurrent compilation processes during the compilation.

pingtoo wrote:
May be you are thinking using "EMERGE_DEFAULT_OPTS=--jobs=N --load-average-X.Y"
Those options only limit/allow corcurrent package "emerging" processes. In the emerge --info output you can see I have actually set them too. Those settings do work. I have very carefully tuned both and they worked perfectly before. For example if I was doing something tasking at the same time I could see each make process drop concurrent compilation processes.

I wonder if this this is some permissions problem since many compilations are being run in sandbox... Does sandboxing hide /proc/loadavg for example?
_________________
..: Zucca :..

My gentoo installs:
init=/sbin/openrc-init
-systemd -logind -elogind seatd

Quote:
I am NaN! I am a man!
Back to top
View user's profile Send private message
Hu
Administrator
Administrator


Joined: 06 Mar 2007
Posts: 22626

PostPosted: Tue Sep 19, 2023 7:59 pm    Post subject: Reply with quote

As a minor point, per info make, it looks like --load-average can never cause Make to drop to 0 jobs. It will always run at least 1, no matter how bad the load:
Code:
     Specifies that no new recipes should be started if there are other
     recipes running and the load average is at least LOAD (a
     floating-point number).
That first part "there are other recipes running" seems to mean that if there are no jobs open, it will ignore load average and start one.

This does not explain how it got above 9, but it could easily reach 9 if rust drives load to 8, then nodejs creates a job because it has none.

As a related idea, load average could briefly go much higher, since a job will not instantaneously update in response to new processes. Suppose both packages had 0 jobs running, and a system load average of 0. Both packages would observe that the load average is low enough to allow them to use their full --jobs. Once all those jobs are open, you hit 16. --load-average would prohibit replacing them until the system load drops, but if they are sufficiently long-lived, you could be above 8 for some time. Your latest post suggests this is not what happened, but it is a possible failure mode, I think.
Back to top
View user's profile Send private message
pingtoo
Veteran
Veteran


Joined: 10 Sep 2021
Posts: 1240
Location: Richmond Hill, Canada

PostPosted: Tue Sep 19, 2023 8:32 pm    Post subject: Reply with quote

I too observe similar pattern when I update with my RPI 4B with a distcc farm of 10 helper nodes.

However I did notice in my case the job count will not go above only when the load average persist for long time (said more than a few minutes). Also my load average refresh rate is a 10 seconds so I don't know if in between the 10 seconds may be somehow the load were drop to below the constraint.
Back to top
View user's profile Send private message
Genone
Retired Dev
Retired Dev


Joined: 14 Mar 2003
Posts: 9608
Location: beyond the rim

PostPosted: Thu Sep 21, 2023 1:13 pm    Post subject: Reply with quote

--load-avg is more of a suggestion than a hard limit. Also it only applies to spawning new make processes, so if make is launching other programs and those fork into multiple processes, that is not affected by the initial make options (if other tools launch multiple make processes, that is a different story). Also the documentation doesn't specify which load-avg is used, e.g. if it is using the 15 minutes average it will of course take quite a while before the limit is reached.

Btw, gnu make did apparently change the implementation for --load-avg in the most recent version 4.4:
Quote:
* New feature: Improved support for -l / --load-average
On systems that provide /proc/loadavg (Linux), GNU Make will use it to
determine the number of runnable jobs and use this as the current load,
avoiding the need for heuristics.

So if you're noticing changed behavior it might be related to this.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Portage & Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum