3

In htop, there appear bars that show CPU, MEMORY and SWAP.

In What exactly do the colors in htop status bars mean? , I saw the meaning of the colors for the CPU bar and the MEMORY bar.

What do the colors mean in the swap bar?

I could find no mention in the htop man.

josinalvo
  • 149

2 Answers2

6

The Swap Bar has only one colour (red) which simply indicates how much swap memory is being used. You can see this by pressing h (or F1) while running htop.

1

Hitting F1 will show this (most probably this wasn't available 7 years ago!): htop help

Which means:

  • red is used swap, that can't be removed
  • orange is cached swap, that can be removed if needed

When you go out of used space, kernel will launch Out-of-memory killer (OOM killer) to free some memory (be it in RAM or Swap).

You can retrieve the Swap cached/used values with /proc/meminfo:

# grep Swap /proc/meminfo
SwapCached:       430276 kB
SwapTotal:       2097136 kB
SwapFree:              0 kB
Yvan
  • 500