summaryrefslogtreecommitdiff
path: root/src/oom/oomd-manager.h
diff options
context:
space:
mode:
authorAnita Zhang <the.anitazha@gmail.com>2021-03-24 02:17:04 -0700
committerAnita Zhang <the.anitazha@gmail.com>2021-04-01 19:44:14 -0700
commit81d66fab342e112aefe8b5f43bc853ef66c92add (patch)
tree38a79355fc512b0bc2f80ebd8445255c32f0d816 /src/oom/oomd-manager.h
parent8ab34a49dbf75fd731973359a6f24c212682f479 (diff)
downloadsystemd-81d66fab342e112aefe8b5f43bc853ef66c92add.tar.gz
oomd: split swap and mem pressure event timers
One thing that came out of the test week is that systoomd needs to poll more frequently so as not to race with the kernel oom killer in situations where memory is eaten quickly. Memory pressure counters are lagging so it isn't worthwhile to change the current read rate; however swap is not lagging and can be checked more frequently. So let's split these into 2 different timer events. As a result, swap now also doesn't have to be subject to the post-action (post-kill) delay that we need for memory pressure events. Addresses some of slowness to kill discussed in https://bugzilla.redhat.com/show_bug.cgi?id=1941340
Diffstat (limited to 'src/oom/oomd-manager.h')
-rw-r--r--src/oom/oomd-manager.h9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/oom/oomd-manager.h b/src/oom/oomd-manager.h
index 9c580c8a24..3df7ce94d7 100644
--- a/src/oom/oomd-manager.h
+++ b/src/oom/oomd-manager.h
@@ -7,7 +7,9 @@
#include "varlink.h"
/* Polling interval for monitoring stats */
-#define INTERVAL_USEC (1 * USEC_PER_SEC)
+#define SWAP_INTERVAL_USEC 150000 /* 0.15 seconds */
+/* Pressure counters are lagging (~2 seconds) compared to swap so polling too frequently just wastes CPU */
+#define MEM_PRESSURE_INTERVAL_USEC (1 * USEC_PER_SEC)
/* Used to weight the averages */
#define AVERAGE_SIZE_DECAY 4
@@ -45,9 +47,10 @@ struct Manager {
OomdSystemContext system_context;
usec_t last_reclaim_at;
- usec_t post_action_delay_start;
+ usec_t mem_pressure_post_action_delay_start;
- sd_event_source *cgroup_context_event_source;
+ sd_event_source *swap_context_event_source;
+ sd_event_source *mem_pressure_context_event_source;
Varlink *varlink;
};