summaryrefslogtreecommitdiff
path: root/src/oom/oomd-util.c
diff options
context:
space:
mode:
authorAnita Zhang <the.anitazha@gmail.com>2021-03-27 02:02:00 -0700
committerAnita Zhang <the.anitazha@gmail.com>2021-04-01 19:52:49 -0700
commit69c8f0255a0a8127548907028bef09ea66056f9f (patch)
treefa5bd68f84e3bbeece5e226f09c5087733e64e3e /src/oom/oomd-util.c
parentdf637ede7b4e1d0faf8d620d626a0af230712a9e (diff)
downloadsystemd-69c8f0255a0a8127548907028bef09ea66056f9f.tar.gz
oomd: rename last_hit_mem_pressure_limit -> mem_pressure_limit_hit_start
Since this is only changed the first time the limit is hit (and remains set as long as the pressure remains over), I changed the name to better reflect that. Keeps consistent with "last_had_mem_reclaim" which is actually updated every time there is reclaim activity.
Diffstat (limited to 'src/oom/oomd-util.c')
-rw-r--r--src/oom/oomd-util.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/oom/oomd-util.c b/src/oom/oomd-util.c
index fcab31830c..a1813bfd81 100644
--- a/src/oom/oomd-util.c
+++ b/src/oom/oomd-util.c
@@ -82,17 +82,17 @@ int oomd_pressure_above(Hashmap *h, usec_t duration, Set **ret) {
if (ctx->memory_pressure.avg10 > ctx->mem_pressure_limit) {
usec_t diff;
- if (ctx->last_hit_mem_pressure_limit == 0)
- ctx->last_hit_mem_pressure_limit = now(CLOCK_MONOTONIC);
+ if (ctx->mem_pressure_limit_hit_start == 0)
+ ctx->mem_pressure_limit_hit_start = now(CLOCK_MONOTONIC);
- diff = now(CLOCK_MONOTONIC) - ctx->last_hit_mem_pressure_limit;
+ diff = now(CLOCK_MONOTONIC) - ctx->mem_pressure_limit_hit_start;
if (diff >= duration) {
r = set_put(targets, ctx);
if (r < 0)
return -ENOMEM;
}
} else
- ctx->last_hit_mem_pressure_limit = 0;
+ ctx->mem_pressure_limit_hit_start = 0;
}
if (!set_isempty(targets)) {
@@ -417,7 +417,7 @@ int oomd_insert_cgroup_context(Hashmap *old_h, Hashmap *new_h, const char *path)
if (old_ctx) {
curr_ctx->last_pgscan = old_ctx->pgscan;
curr_ctx->mem_pressure_limit = old_ctx->mem_pressure_limit;
- curr_ctx->last_hit_mem_pressure_limit = old_ctx->last_hit_mem_pressure_limit;
+ curr_ctx->mem_pressure_limit_hit_start = old_ctx->mem_pressure_limit_hit_start;
curr_ctx->last_had_mem_reclaim = old_ctx->last_had_mem_reclaim;
}
@@ -447,7 +447,7 @@ void oomd_update_cgroup_contexts_between_hashmaps(Hashmap *old_h, Hashmap *curr_
ctx->last_pgscan = old_ctx->pgscan;
ctx->mem_pressure_limit = old_ctx->mem_pressure_limit;
- ctx->last_hit_mem_pressure_limit = old_ctx->last_hit_mem_pressure_limit;
+ ctx->mem_pressure_limit_hit_start = old_ctx->mem_pressure_limit_hit_start;
ctx->last_had_mem_reclaim = old_ctx->last_had_mem_reclaim;
if (oomd_pgscan_rate(ctx) > 0)