mapped_ratio can be calculated like so:
mapped ratio = (nr mapped * 100) / total memory;
nr_mapped can be read from
$ grep nr_mapped /proc/vmstat
According to this article, titled: Linux Memory - Implementation Notes
“This is a measurement of how much difficulty the VM is having reclaiming pages. Each time the VM tries to reclaim memory, it scans 1/nth of the inactive lists in each zone in an effort to reclaim pages. Each time a pass over the list is made, if the number of inactive clean + free pages in that zone is not over the low water mark, n is decreased by one. Distress is measured as 100 >> n” 5
In researching much of the docs make it sounds as though "distress" is a kernel counter but it is not. Rather it's a value that's used when each zone of memory is being scanned, that is progressively increased as page frames of memory are scanned by the kernel in an attempt to reclaim them. Discussion of this is beyond the scope of this Q&A but if you're curious the section of the book "Understanding the Linux Kernel", Chapter 17: Page Frame Reclaiming. The value of "distress" comes from the value "prev_priority" as the zones are scanned.