I'm trying to track down repetitive hangs on an oldish laptop (10yo, 4Gb of mem, 2 cores, Kubuntu 18.04) It now happens several times a day with moderate use (<10 tabs open in firefox, a bunch of other progs, nothing huge).

Sometimes I get a OOM but in most cases the user interface crawls to a halt for one to 30 minutes before things go back to normal. This is a recent occurrence (last 2 months). In most cases there's nothing in dmesg or syslog.

I've been trying to diagnose it without success, but one thing I've noticed with htop is that the load average jumps to 30 or more while the cumulative CPU usage stays below 10% and the memory usage (Mem+Swap) stays well below 4Gb.

1st question: how can the load average be so different from the CPU usage ? 2nd question: what else can I do? Can I run some stress programs and hope to get meaningful info?

[Edit] Still waiting for the next crash, but I notice that swapiness is at 0. Shouldn't it be 60 by default ?

  • 1
    Sounds like a memory or swap problem. Edit your question and show me free -h and sudo blkid and grep -i swap /etc/fstab and sysctl vm.swappiness. What version Ubuntu? Start comments to me with @heynnema or I may miss them. – heynnema May 12 '20 at 14:26
  • @heynnema I set the swapiness to 60 (it was at 0) and there hasn't been a single hang since then. Will update if not. – dargaud Jun 3 '20 at 14:22

From the comments...

As I suspected, there was a swap problem. In this case, it wasn't swapping at all.

For 4G RAM, set the vm.swappiness to 60 (it was at 0 - which was a totally wrong setting) and there hasn't been a single hang since then.


Question 1: how can the load average be so different from the CPU usage ?

In both Linux and Unix, load averages include pending processes. In linux, as opposed to unix, load averages include I/O waits, such as waiting for disk reads or writes, and pending processes.

Let's use a magnetic disk (long seek time) to demonstrate high load average with low cpu usage, by having several tasks reading random sectors in a large file. The system gets bogged down with I/O waits.

System virtually idle:

doug@s15:~$ sudo turbostat --Summary --quiet --show Busy%,Bzy_MHz,PkgTmp,PkgWatt,GFXWatt,IRQ --interval 60
Busy%   Bzy_MHz IRQ     PkgTmp  PkgWatt GFXWatt
0.38    1806    27911   30      4.12    0.12
0.37    1858    27147   29      4.14    0.12

But very high load average:

doug@s15:~$ uptime
 22:47:01 up 1 day, 13:36,  5 users,  load average: 49.00, 47.85, 34.30

Question 2: what else can I do?

Your symptoms sounds like heavy swapping. You claim low memory use, but I would guess that isn't always true, and you sometimes get into a lot of swapping, and one time you even ran out of memory entirely.

  • I also suspect swapping. How can I be sure and what can I do about it ? Has Firefox multiplied its memory use in recent weeks ? 4Gb should be enough for having 10 tabs (youtube, facebook, etc) open, no ? – dargaud May 12 '20 at 12:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.