--- proc/sysinfo.c +++ proc/sysinfo.c 2015-01-27 15:04:57.337518882 +0000 @@ -708,8 +708,14 @@ nextline: kb_main_cached = kb_page_cache + kb_slab; if ((ev=getenv("PS_FULL_CACHE"))) kb_main_cached += kb_slab_reclaimable + kb_swap_cached + kb_nfs_unstable; - kb_swap_used = kb_swap_total - kb_swap_free; - kb_main_used = kb_main_total - kb_main_free - kb_main_cached - kb_main_buffers; + if (kb_swap_total > kb_swap_free) + kb_swap_used = kb_swap_total - kb_swap_free; + else + kb_swap_used = 0; + if (kb_main_total > kb_main_free + kb_main_cached + kb_main_buffers) + kb_main_used = kb_main_total - kb_main_free - kb_main_cached - kb_main_buffers; + else + kb_main_used = 0; /* zero? might need fallback for 2.6.27 <= kernel kb_low_free) + kb_low_used = kb_low_total - kb_low_free; + else + kb_low_used = 0; + + if (kb_high_total > kb_high_free) + kb_high_used = kb_high_total - kb_high_free; + else + kb_high_used = 0; + printf("%-7s", _("Low:")); printf(" %11s", scale_size(kb_low_total, flags, args)); - printf(" %11s", scale_size(kb_low_total - kb_low_free, flags, args)); + printf(" %11s", scale_size(kb_low_used, flags, args)); printf(" %11s", scale_size(kb_low_free, flags, args)); printf("\n"); printf("%-7s", _("High:")); printf(" %11s", scale_size(kb_high_total, flags, args)); - printf(" %11s", scale_size(kb_high_total - kb_high_free, flags, args)); + printf(" %11s", scale_size(kb_high_used, flags, args)); printf(" %11s", scale_size(kb_high_free, flags, args)); printf("\n"); }