[Devel] [PATCH RHEL7 COMMIT] Revert "ve/mm: ignore oom_score_adj of containerized tasks on global OOM"

Vladimir Davydov vdavydov at odin.com
Mon Sep 7 03:15:44 PDT 2015


The commit is pushed to "branch-rh7-3.10.0-229.7.2-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-229.7.2.vz7.6.7
------>
commit be12c3cce517a1f9eb818b151b5497b351bcd36b
Author: Vladimir Davydov <vdavydov at parallels.com>
Date:   Mon Sep 7 14:15:44 2015 +0400

    Revert "ve/mm: ignore oom_score_adj of containerized tasks on global OOM"
    
    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 <vdavydov at parallels.com>
    Reviewed-by: Kirill Tkhai <ktkhai at odin.com>
    
    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 04f4f579c36c..17100d02e8d3 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 70893730524a..e5d0b8675f0c 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;



More information about the Devel mailing list