htop icon indicating copy to clipboard operation
htop copied to clipboard

make new color for dirty / writeback cache

Open benapetr opened this issue 1 year ago • 1 comments

Right now all disk caches are in same color (yellowish on my system). In Windows Task manager dirty buffers are using different color from regular disk cache because it is indeed different: while regular disk cache can be dropped on spot when RAM is needed, dirty buffers first need to be written to disk before RAM can be used.

It would also nicely show how effectively is RAM used to speed up disk writes or visualize the current OS settings. Dirty buffers can be loaded from /proc/meminfo:

root@odroidhc4:~# cat /proc/meminfo
MemTotal:        3872120 kB
MemFree:          144236 kB
MemAvailable:    3593088 kB
Buffers:             216 kB
Cached:          3478616 kB
SwapCached:          436 kB
Dirty:           2799032 kB
Writeback:        199648 kB

They are subset of Cached memory, but since their nature is different, they should have slightly different color in memory overview bar.

benapetr avatar Jun 23 '24 11:06 benapetr

This is the view I am talking about, it would be nice to be able to see this interactively on Linux as well:

image

When you start writing a lot to a disk, this memory buffer grows and contains memory that needs to be written before it can be reused for another purpose.

htop merges this memory view with all other disk buffers and caches, which is far less useful than the way windows task manager does that.

benapetr avatar Jul 04 '24 19:07 benapetr

I think this will be a great feature. I am tuning those sysctls, which controls dirty page writeback behavior, on my machines, using watch cat /proc/meminfo to monitor the stats. It would be easier if htop provide a graphic view.

nicolas-yangli avatar Nov 28 '24 07:11 nicolas-yangli