You are not logged in.

#1 2018-10-08 19:49:24

Roken
Member
From: South Wales, UK
Registered: 2012-01-16
Posts: 1,251

Can someone explain a makepkg.conf option

Tonight I was offered updates to webkitgtk and webkitgtk2. I have a Ryzen 1800x, 8 core, 16 thread, which was configured to use all cores and all threads when building. After three goes and three failures, with RAM usage hitting 88% (16 Gb RAM) and eventually, just a total freeze. I modified makepkg.conf to take -j14, effectively leaving two threads free for the system, and RAM usage dropped to max 25- 26%, and the build continued. (OK, it failed, but that's a different issue - there was no freeze).

I assumed that gcc was smart enough by now to know when to quit, so what exactly is the difference between using all cores maxed out at 100%, and leaving 2 free (all 16 threads still hit 90+%, but there was headroom. I assume the difference is simply thread switching, and that two cores are not reserved, but rather enough headroom is kept available across the cores), and why did RAM usage drop so dramatically?

I'm a little out of my element in understanding this.

Last edited by Roken (2018-10-08 19:50:15)


Ryzen 5900X 12 core/24 thread - RTX 3090 FE 24 Gb, Asus Prime B450 Plus, 32Gb Corsair DDR4, Cooler Master N300 chassis, 5 HD (1 NvME PCI, 4SSD) + 1 x optical.
Linux user #545703

Offline

#2 2018-10-08 19:54:22

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,595
Website

Re: Can someone explain a makepkg.conf option

MAKEFLAGS="-j16" is just passed to gcc when building so it's really gcc doing whatever to the system memory.  I cannot explain the difference in a free memory, but I don't see how the number of threads passed on to gcc would explain the 25% uses with -j14 to the 88% use with -j16.


CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

#3 2018-10-08 20:09:59

Roken
Member
From: South Wales, UK
Registered: 2012-01-16
Posts: 1,251

Re: Can someone explain a makepkg.conf option

I'm assuming that the extra threads are doing something that the other 14 aren't, and so demanding extra RAM, but the difference is astounding.

I should add, this is the first time I've seen this.

Last edited by Roken (2018-10-08 20:10:43)


Ryzen 5900X 12 core/24 thread - RTX 3090 FE 24 Gb, Asus Prime B450 Plus, 32Gb Corsair DDR4, Cooler Master N300 chassis, 5 HD (1 NvME PCI, 4SSD) + 1 x optical.
Linux user #545703

Offline

#4 2018-10-08 20:14:45

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,595
Website

Re: Can someone explain a makepkg.conf option

Yes, it doesn't scale linearly at all... have you verified that the effect is reproducible?


CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

#5 2018-10-08 21:03:01

Roken
Member
From: South Wales, UK
Registered: 2012-01-16
Posts: 1,251

Re: Can someone explain a makepkg.conf option

I have. Even after a reboot. As it happens, a quick pacman -Qi showed both webkitgtk and webkitgtk2 are obsolete on my system, so I've removed them. Nevertheless, I'd look to understand the mechanics.

EDIT: By obsolete, I mean both were installed as dependencies at some time, but nothing depends on either now.

Last edited by Roken (2018-10-08 21:03:59)


Ryzen 5900X 12 core/24 thread - RTX 3090 FE 24 Gb, Asus Prime B450 Plus, 32Gb Corsair DDR4, Cooler Master N300 chassis, 5 HD (1 NvME PCI, 4SSD) + 1 x optical.
Linux user #545703

Offline

#6 2018-10-08 21:24:18

loqs
Member
Registered: 2014-03-06
Posts: 17,197

Re: Can someone explain a makepkg.conf option

If anything in usespace manages to hardlock the system that would be a hardware bug or a kernel issue.  Pedantic point MAKEFLAGS is for make which parallelizes invocation of gcc etc.

Offline

#7 2018-10-08 22:25:30

eschwartz
Fellow
Registered: 2014-08-08
Posts: 4,097

Re: Can someone explain a makepkg.conf option

graysky wrote:

MAKEFLAGS="-j16" is just passed to gcc when building so it's really gcc doing whatever to the system memory.  I cannot explain the difference in a free memory, but I don't see how the number of threads passed on to gcc would explain the 25% uses with -j14 to the 88% use with -j16.

No, that's really not even remotely true.

MAKEFLAGS is, as the name indicates, arguments to the /usr/bin/make command.

make, natively reads this variable and pretends when you run:

export MAKEFLAGS=-j16
make

that you actually ran

make -j16

Make then says "okay, let's try to build targets from this makefile, building up to 16 targets simultaneously".

Each Makefile target is *one* gcc subprocess to compile an object file. If gcc is multi-threaded on top of that then it would independently attempt to compile *one* object file using multiple cores.
gcc is not multithreaded. It will spawn more processes to run cc1, cc1plus, as, etc. though, and with -pipe those may be piped together. But that's hardly configurable anyway.
(Linkers, like lld or gold, can be and are multithreaded, since that's a single bottleneck whereas compiling .o object files is already plenty parallel by simply compiling lots of separate files at the same time in different gcc processes.)

Anyway, make cannot build with 16 cores unless there are 16 targets available to build with no pending dependencies.

Roken wrote:

After three goes and three failures, with RAM usage hitting 88% (16 Gb RAM) and eventually, just a total freeze.

Can we define what the word "freeze" means?

Because I suspect what you mean is "it was compiling something huge and prioritizing that, so everything else on the system came to a screeching halt while it bravely marched on, until I got scared and killed the still-working process halfway through".
Note that overloading the system like this is kind of bad, since you end up spending almost more of your time swapping between the compiler and random programs like your browser, than actually doing work.
Either way, you'll eventually get there.

To me, a "total freeze" means the computer started hanging and doing nothing at all. Which is very different as it implies no amount of waiting would help. Also if the compiler managed to actually freeze your system, it implies that there is something wrong on a much more fundamental level, which hopefully isn't hardware-based...

Last edited by eschwartz (2018-10-08 22:30:45)


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

#8 2018-10-09 04:40:12

Roken
Member
From: South Wales, UK
Registered: 2012-01-16
Posts: 1,251

Re: Can someone explain a makepkg.conf option

By freeze I mean a complete system freeze, totally unresponsive. I have my own home brew animated mouse cursor, and watched that as a test. After 5 minutes, it hadn't advanced so much as a single frame, and only a hard reset worked.

Ruling out a H/W problem, I left the system overnight rendering with Blender on hybrid CPU/GPU rendering which completed without issue. Building webkitgtk is literally the only time I've seen this, and as I mentioned, after checking, it was an old dependency for something and no longer needed, so I've been able to remove anyway.


Ryzen 5900X 12 core/24 thread - RTX 3090 FE 24 Gb, Asus Prime B450 Plus, 32Gb Corsair DDR4, Cooler Master N300 chassis, 5 HD (1 NvME PCI, 4SSD) + 1 x optical.
Linux user #545703

Offline

#9 2018-10-09 08:37:40

Lone_Wolf
Member
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 11,868

Re: Can someone explain a makepkg.conf option

Have you configured REISUB ?

Tonight I was offered updates to webkitgtk and webkitgtk2.

That suggests you use an aur helper or a custom script.

I modified makepkg.conf to take -j14, effectively leaving two threads free for the system, and RAM usage dropped to max 25- 26%, and the build continued. (OK, it failed, but that's a different issue - there was no freeze).

Was the build fail with -j14 when makepkg was run directly or with the same aur helper/custom script ?
If the former, the problem might be with the helper/script.

Last edited by Lone_Wolf (2018-10-09 08:38:10)


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.


(A works at time B)  && (time C > time B ) ≠  (A works at time C)

Offline

#10 2018-10-09 20:00:39

Roken
Member
From: South Wales, UK
Registered: 2012-01-16
Posts: 1,251

Re: Can someone explain a makepkg.conf option

OK. It seems there was a fix to the PKGBUILD yesterday to fix the build failure, which does work. I manually built (no AUR helper) with -j14, and it completed. I was watching (though for a half hour build I may have glanced away once or twice), but as best as I could see, RAM usage maxed at around 30%, and quickly dropped back down.

Test two: All cores enabled again - no swap memory. Inside of two minutes, RAM usage climbed, hit around 82% this time (it's inconsistent - one time I got to 92%) and then the desktop just freezes.

Now, I'm not sure it's a complete system freeze. The HD activity light on the case still flickered intermittently with no obvious pattern, but the desktop was dead (i.e. completely unresponsive - even the mouse cursor animation was stuck), and even after leaving it half an hour, nothing.

However, in favour of a complete freeze, my laptop (also Arch) shares my mouse an KB via synergy. The laptop screen never goes to sleep as long as the main desktop is on. Following these freezes, it does go to sleep. A reboot of the desktop brings the laptop display back.

Could this be a kernel bug? As I've said, I can put the system under max load otherwise with no problems, and so I don't suspect a hardware problem, and the massive difference in RAM usage would suggest it isn't hardware, not to mention this is a new system (pre-built MB, CPU, RAM and Cooler) with no previous issues. My full spec is in my sig.

As I've mentioned, it seems I may no longer need webkitgtk, and so it's removed, and I'm leaving -j14 in place for now, but I'd like to know what's causing this. It looks like it could be more of a serious issue than I thought.

Last edited by Roken (2018-10-09 20:10:58)


Ryzen 5900X 12 core/24 thread - RTX 3090 FE 24 Gb, Asus Prime B450 Plus, 32Gb Corsair DDR4, Cooler Master N300 chassis, 5 HD (1 NvME PCI, 4SSD) + 1 x optical.
Linux user #545703

Offline

#11 2018-10-09 20:37:52

loqs
Member
Registered: 2014-03-06
Posts: 17,197

Re: Can someone explain a makepkg.conf option

Does adding the boot option rcu-nocbs=0-15 have any effect on the lockup?

Offline

Board footer

Powered by FluxBB