Otherwise, oomctl shows 0 memory and swap usage when swap monitoring
is not enabled.
=======
$ oomctl
Dry Run: no
Swap Used Limit: 90.00%
Default Memory Pressure Limit: 60.00%
Default Memory Pressure Duration: 20s
System Context:
Memory: Used: 0B Total: 0B
Swap: Used: 0B Total: 0B
Swap Monitored CGroups:
Memory Pressure Monitored CGroups:
...
======
_cleanup_(memstream_done) MemStream ms = {};
OomdCGroupContext *c;
FILE *f;
+ int r;
assert(m);
assert(ret);
+ /* Always reread memory/swap info here. Otherwise it may be outdated if swap monitoring is off.
+ * Let's make sure to always report up-to-date data. */
+ r = oomd_system_context_acquire("/proc/meminfo", &m->system_context);
+ if (r < 0)
+ log_debug_errno(r, "Failed to acquire system context, ignoring: %m");
+
f = memstream_init(&ms);
if (!f)
return -ENOMEM;