0

Dirty %lu - Memory which is waiting to get written back to the disk.

Writeback %lu - Memory which is actively being written back to the disk.

-- man proc

Does Dirty include Writeback? Or is it excluded?

My kernel version is 4.18.16-200.fc28.x86_64.

2 Answers 2

2

“Dirty” and “Writeback” are separate stats and page states; for proof of this, see for example node_dirty_ok:

nr_pages += node_page_state(pgdat, NR_FILE_DIRTY);
nr_pages += node_page_state(pgdat, NR_UNSTABLE_NFS);
nr_pages += node_page_state(pgdat, NR_WRITEBACK);

return nr_pages <= limit;

If one included the other, that would be taken into account here.

/proc/meminfo doesn’t process the corresponding values either:

show_val_kb(m, "Dirty:          ",
        global_node_page_state(NR_FILE_DIRTY));
show_val_kb(m, "Writeback:      ",
        global_node_page_state(NR_WRITEBACK));
0

I think Dirty excludes Writeback.

dd if=/dev/zero of=~/X.img bs=1M count=1 ; sync & for i in 1 2 3; do grep -E '^(Dirty:|Writeback:|MemFree:|Cached:)' /proc/meminfo ; done
1+0 records in
1+0 records out
1048576 bytes (1.0 MB, 1.0 MiB) copied, 0.00316564 s, 331 MB/s
[1] 13140
MemFree:         1461832 kB
Cached:          1475188 kB
Dirty:               132 kB
Writeback:          1032 kB
...

(Although this is only proof if /proc/meminfo is guaranteed 100% consistent).

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.