Add tests for memory.oom.group
Add tests for memory.oom.group for the following cases: - Killing all processes in a leaf cgroup, but leaving the parent untouched - Killing all processes in a parent and leaf cgroup - Keeping processes marked by OOM_SCORE_ADJ_MIN alive when considered for being killed by the group oom killer. Signed-off-by: Jay Kamat <jgkamat@fb.com> Acked-by: Roman Gushchin <guro@fb.com> Signed-off-by: Shuah Khan (Samsung OSG) <shuah@kernel.org>
This commit is contained in:

committed by
Shuah Khan (Samsung OSG)

parent
48c2bb0b9c
commit
a987785dcd
@@ -348,3 +348,24 @@ int is_swap_enabled(void)
|
||||
|
||||
return cnt > 1;
|
||||
}
|
||||
|
||||
int set_oom_adj_score(int pid, int score)
|
||||
{
|
||||
char path[PATH_MAX];
|
||||
int fd, len;
|
||||
|
||||
sprintf(path, "/proc/%d/oom_score_adj", pid);
|
||||
|
||||
fd = open(path, O_WRONLY | O_APPEND);
|
||||
if (fd < 0)
|
||||
return fd;
|
||||
|
||||
len = dprintf(fd, "%d", score);
|
||||
if (len < 0) {
|
||||
close(fd);
|
||||
return len;
|
||||
}
|
||||
|
||||
close(fd);
|
||||
return 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user