Skip to content

Commit

Permalink
cgroup: Stumble on if we can't set up oom handling
Browse files Browse the repository at this point in the history
OpenShift 4.13 tentatively plans to use cgroupv1 on a RHEL9
era kernel, which breaks only in `PREEMPT_RT` aka `kernel-rt`
due to
torvalds/linux@2343e88

For now let's stumble on without oom notifications.

Signed-off-by: Colin Walters <walters@verbum.org>
  • Loading branch information
cgwalters committed Feb 27, 2023
1 parent 158b542 commit b1c52a7
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/cgroup.c
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,15 @@ static void setup_oom_handling_cgroup_v1(int pid)
pexit("Failed to create eventfd");

_cleanup_free_ char *data = g_strdup_printf("%d %d", oom_event_fd, oom_cgroup_fd);
if (write_all(cfd, data, strlen(data)) < 0)
pexit("Failed to write to cgroup.event_control");
if (write_all(cfd, data, strlen(data)) < 0) {
/* This used to be fatal, but we make it advisory and stumble on because
* https://github.com/torvalds/linux/commit/2343e88d238f5de973d609d861c505890f94f22e
* disables this interface in PREEMPT_RT kernel configs.
*/
nwarnf("Failed to write to cgroup.event_control");
g_free(memory_cgroup_file_path);
return;
}

g_unix_fd_add(oom_event_fd, G_IO_IN, oom_cb_cgroup_v1, memory_cgroup_file_path);
}
Expand Down

0 comments on commit b1c52a7

Please sign in to comment.