mirror of
https://github.com/systemd/systemd
synced 2026-03-30 03:34:49 +02:00
Compare commits
2 Commits
f295cfa1a7
...
dff4fb7c35
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
dff4fb7c35 | ||
|
|
38e9d40c80 |
@ -337,6 +337,12 @@ int oomd_kill_by_pgscan_rate(Hashmap *h, const char *prefix, bool dry_run, char
|
|||||||
if (c->pgscan == 0 && c->current_memory_usage == 0)
|
if (c->pgscan == 0 && c->current_memory_usage == 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
/* First try killing recursively to ensure all child cgroups can be killed. */
|
||||||
|
r = cg_kill_recursive(c->path, /* sig= */ 0, CGROUP_IGNORE_SELF, /* killed_pids= */ NULL,
|
||||||
|
/* log_kill= */ NULL, /* userdata= */ NULL);
|
||||||
|
if (r < 0)
|
||||||
|
continue;
|
||||||
|
|
||||||
r = oomd_cgroup_kill(c->path, /* recurse= */ true, /* dry_run= */ dry_run);
|
r = oomd_cgroup_kill(c->path, /* recurse= */ true, /* dry_run= */ dry_run);
|
||||||
if (r == -ENOMEM)
|
if (r == -ENOMEM)
|
||||||
return r; /* Treat oom as a hard error */
|
return r; /* Treat oom as a hard error */
|
||||||
@ -381,6 +387,12 @@ int oomd_kill_by_swap_usage(Hashmap *h, uint64_t threshold_usage, bool dry_run,
|
|||||||
if (c->swap_usage <= threshold_usage)
|
if (c->swap_usage <= threshold_usage)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
/* First try killing recursively to ensure all child cgroups can be killed. */
|
||||||
|
r = cg_kill_recursive(c->path, /* sig= */ 0, CGROUP_IGNORE_SELF, /* killed_pids= */ NULL,
|
||||||
|
/* log_kill= */ NULL, /* userdata= */ NULL);
|
||||||
|
if (r < 0)
|
||||||
|
continue;
|
||||||
|
|
||||||
r = oomd_cgroup_kill(c->path, /* recurse= */ true, /* dry_run= */ dry_run);
|
r = oomd_cgroup_kill(c->path, /* recurse= */ true, /* dry_run= */ dry_run);
|
||||||
if (r == -ENOMEM)
|
if (r == -ENOMEM)
|
||||||
return r; /* Treat oom as a hard error */
|
return r; /* Treat oom as a hard error */
|
||||||
|
|||||||
@ -240,8 +240,8 @@ static int run(int argc, char *argv[]) {
|
|||||||
if (geteuid() != 0 || have_effective_cap(CAP_SYS_ADMIN) <= 0)
|
if (geteuid() != 0 || have_effective_cap(CAP_SYS_ADMIN) <= 0)
|
||||||
return log_tests_skipped("not running privileged");
|
return log_tests_skipped("not running privileged");
|
||||||
|
|
||||||
if (detect_container() > 0)
|
if (detect_container() > 0 || running_in_chroot() > 0)
|
||||||
return log_tests_skipped("Test not supported in a container, requires udev/uevent notifications");
|
return log_tests_skipped("Test not supported in a container/chroot, requires udev/uevent notifications");
|
||||||
|
|
||||||
assert_se(loop_device_make(fd, O_RDWR, 0, UINT64_MAX, 0, LO_FLAGS_PARTSCAN, LOCK_EX, &loop) >= 0);
|
assert_se(loop_device_make(fd, O_RDWR, 0, UINT64_MAX, 0, LO_FLAGS_PARTSCAN, LOCK_EX, &loop) >= 0);
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user