Why is Dirty and Writeback part of "MemAvailable" in /proc/meminfo?

From: Petr Bena
Date: Sun Jun 23 2024 - 09:03:29 EST


Hello,

Apologies if this is already answered somewhere, but quick google search returned nothing on-topic:

There is one thing that really puzzles me about /proc/meminfo (and subsequently about data reported by all other tools, like free, top etc. that take those numbers from same place) - why is "dirty" and "writeback" part of "available" memory?

My understanding is that "available" was introduced to confuse less users by relatively low amount of "free" memory, which is very often occupied by disk and FS caches as it can be dropped almost any time as needed, but that's not quite the case with writeback and dirty memory - both of them have to be written to the disk first, which is not an instant operation, in fact with slow storage it takes some time during which memory is unusable, so there is nothing inherently "available" about that memory.

If you configure your kernel for aggressive caching and run some large IO writing operations, most of your memory is going to be full by dirty pages and should some program need to quickly allocate it, it would fail, yet /proc/meminfo would be reporting plenty of available memory.

Shouldn't this logic be changed? What's the reasoning behind that?

Thanks