33 lines
1.1 KiB
Diff
33 lines
1.1 KiB
Diff
|
---
|
||
|
psutil/_pslinux.py | 12 ++++++------
|
||
|
1 file changed, 6 insertions(+), 6 deletions(-)
|
||
|
|
||
|
--- a/psutil/_pslinux.py
|
||
|
+++ b/psutil/_pslinux.py 2022-06-23 09:43:10.973822573 +0000
|
||
|
@@ -473,12 +473,6 @@ def virtual_memory():
|
||
|
except KeyError:
|
||
|
slab = 0
|
||
|
|
||
|
- used = total - free - cached - buffers
|
||
|
- if used < 0:
|
||
|
- # May be symptomatic of running within a LCX container where such
|
||
|
- # values will be dramatically distorted over those of the host.
|
||
|
- used = total - free
|
||
|
-
|
||
|
# - starting from 4.4.0 we match free's "available" column.
|
||
|
# Before 4.4.0 we calculated it as (free + buffers + cached)
|
||
|
# which matched htop.
|
||
|
@@ -503,6 +497,12 @@ def virtual_memory():
|
||
|
if avail > total:
|
||
|
avail = free
|
||
|
|
||
|
+ used = total - avail
|
||
|
+ if used < 0:
|
||
|
+ # May be symptomatic of running within a LCX container where such
|
||
|
+ # values will be dramatically distorted over those of the host.
|
||
|
+ used = total - free
|
||
|
+
|
||
|
percent = usage_percent((total - avail), total, round_=1)
|
||
|
|
||
|
# Warn about missing metrics which are set to 0.
|