summaryrefslogtreecommitdiff
path: root/src/oom/oomd-util.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/oom/oomd-util.c')
-rw-r--r--src/oom/oomd-util.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/oom/oomd-util.c b/src/oom/oomd-util.c
index da994848ae..894d23a83a 100644
--- a/src/oom/oomd-util.c
+++ b/src/oom/oomd-util.c
@@ -210,16 +210,16 @@ int oomd_cgroup_kill(const char *path, bool recurse, bool dry_run) {
int oomd_kill_by_pgscan_rate(Hashmap *h, const char *prefix, bool dry_run, char **ret_selected) {
_cleanup_free_ OomdCGroupContext **sorted = NULL;
- int r, ret = 0;
+ int n, r, ret = 0;
assert(h);
assert(ret_selected);
- r = oomd_sort_cgroup_contexts(h, compare_pgscan_rate_and_memory_usage, prefix, &sorted);
- if (r < 0)
- return r;
+ n = oomd_sort_cgroup_contexts(h, compare_pgscan_rate_and_memory_usage, prefix, &sorted);
+ if (n < 0)
+ return n;
- for (int i = 0; i < r; i++) {
+ for (int i = 0; i < n; i++) {
/* Skip cgroups with no reclaim and memory usage; it won't alleviate pressure.
* Continue since there might be "avoid" cgroups at the end. */
if (sorted[i]->pgscan == 0 && sorted[i]->current_memory_usage == 0)
@@ -248,18 +248,18 @@ int oomd_kill_by_pgscan_rate(Hashmap *h, const char *prefix, bool dry_run, char
int oomd_kill_by_swap_usage(Hashmap *h, bool dry_run, char **ret_selected) {
_cleanup_free_ OomdCGroupContext **sorted = NULL;
- int r, ret = 0;
+ int n, r, ret = 0;
assert(h);
assert(ret_selected);
- r = oomd_sort_cgroup_contexts(h, compare_swap_usage, NULL, &sorted);
- if (r < 0)
- return r;
+ n = oomd_sort_cgroup_contexts(h, compare_swap_usage, NULL, &sorted);
+ if (n < 0)
+ return n;
/* Try to kill cgroups with non-zero swap usage until we either succeed in
* killing or we get to a cgroup with no swap usage. */
- for (int i = 0; i < r; i++) {
+ for (int i = 0; i < n; i++) {
/* Skip over cgroups with no resource usage.
* Continue break since there might be "avoid" cgroups at the end. */
if (sorted[i]->swap_usage == 0)