This reverts commit fb0f195c52257f8b29ef6cdfc5a0d9433d4e7d24. This won't be necessary as we will take into account not only process badness, but also ub badness.
Signed-off-by: Vladimir Davydov <[email protected]> Conflicts: fs/proc/base.c mm/oom_kill.c --- fs/proc/base.c | 7 ++----- include/linux/oom.h | 10 ---------- mm/oom_kill.c | 10 ---------- 3 files changed, 2 insertions(+), 25 deletions(-) diff --git a/fs/proc/base.c b/fs/proc/base.c index 4a3915674c52..b5744986e3b3 100644 --- a/fs/proc/base.c +++ b/fs/proc/base.c @@ -448,17 +448,14 @@ static int proc_oom_score(struct task_struct *task, char *buffer) { unsigned long totalpages = totalram_pages + total_swap_pages; unsigned long points = 0; - struct mem_cgroup *memcg = NULL; struct user_beancounter *ub = get_exec_ub(); - if (ub != get_ub0()) { + if (ub != get_ub0()) totalpages = min(totalpages, ub_total_pages(ub, true)); - memcg = OOM_BADNESS_DUMMY_MEMCG; - } read_lock(&tasklist_lock); if (pid_alive(task)) - points = oom_badness(task, memcg, NULL, totalpages) * + points = oom_badness(task, NULL, NULL, totalpages) * 1000 / totalpages; read_unlock(&tasklist_lock); return sprintf(buffer, "%lu\n", points); diff --git a/include/linux/oom.h b/include/linux/oom.h index 571b6408bc99..c13af3feba30 100644 --- a/include/linux/oom.h +++ b/include/linux/oom.h @@ -52,16 +52,6 @@ static inline bool oom_task_origin(const struct task_struct *p) /* linux/mm/oom_group.c */ extern int get_task_oom_score_adj(struct task_struct *t); -/* - * oom_score_adj must be 0 for containerized tasks on system-wide OOM, so - * oom_badness will always return 0 if memcg == NULL. However, we need to show - * real oom_badness when /proc/PID/oom_score is read from inside a container. - * Since procuring the memcg corresponding to a container is rather tricky, we - * pass OOM_BADNESS_DUMMY_MEMCG instead, which will make oom_badness act as if - * it was called on local OOM, but without dereferencing the memcg ptr. - */ -#define OOM_BADNESS_DUMMY_MEMCG ((struct mem_cgroup *)1UL) - extern unsigned long oom_badness(struct task_struct *p, struct mem_cgroup *memcg, const nodemask_t *nodemask, unsigned long totalpages); extern void oom_kill_process(struct task_struct *p, gfp_t gfp_mask, int order, diff --git a/mm/oom_kill.c b/mm/oom_kill.c index f598eac397a3..0e6f7535a565 100644 --- a/mm/oom_kill.c +++ b/mm/oom_kill.c @@ -149,14 +149,9 @@ static bool oom_unkillable_task(struct task_struct *p, unsigned long oom_badness(struct task_struct *p, struct mem_cgroup *memcg, const nodemask_t *nodemask, unsigned long totalpages) { - bool global; long points; long adj; - global = !memcg; - if (memcg == OOM_BADNESS_DUMMY_MEMCG) - memcg = NULL; - if (oom_unkillable_task(p, memcg, nodemask)) return 0; @@ -165,11 +160,6 @@ unsigned long oom_badness(struct task_struct *p, struct mem_cgroup *memcg, return 0; adj = get_task_oom_score_adj(p); -#ifdef CONFIG_VE - /* Ignore oom_score_adj of containerized tasks on system-wide OOM */ - if (global && p->task_ve != &ve0) - adj = 0; -#endif if (adj == OOM_SCORE_ADJ_MIN) { task_unlock(p); return 0; -- 2.1.4 _______________________________________________ Devel mailing list [email protected] https://lists.openvz.org/mailman/listinfo/devel
