[alternative-merged] mm-oom_kill-set-oc-constraint-in-constrained_alloc.patch removed from -mm tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The patch titled
     Subject: mm/oom_kill: set oc->constraint in constrained_alloc()
has been removed from the -mm tree.  Its filename was
     mm-oom_kill-set-oc-constraint-in-constrained_alloc.patch

This patch was dropped because an alternative patch was merged

------------------------------------------------------
From: Yafang Shao <laoar.shao@xxxxxxxxx>
Subject: mm/oom_kill: set oc->constraint in constrained_alloc()

In dump_oom_summary() oc->constraint is used to show oom_constraint_text,
but it hasn't been set before.  So the value of it is always the default
value 0.  We should set it in constrained_alloc().

Bellow is the output when memcg oom occurs,

before this patch:
[  133.078102] oom-kill:constraint=CONSTRAINT_NONE,nodemask=(null),
cpuset=/,mems_allowed=0,oom_memcg=/foo,task_memcg=/foo,task=bash,pid=7997,uid=0

after this patch:
[  952.977946] oom-kill:constraint=CONSTRAINT_MEMCG,nodemask=(null),
cpuset=/,mems_allowed=0,oom_memcg=/foo,task_memcg=/foo,task=bash,pid=13681,uid=0

Link: http://lkml.kernel.org/r/1560434150-13626-1-git-send-email-laoar.shao@xxxxxxxxx
Signed-off-by: Yafang Shao <laoar.shao@xxxxxxxxx>
Cc: Michal Hocko <mhocko@xxxxxxxxxx>
Cc: Tetsuo Handa <penguin-kernel@xxxxxxxxxxxxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
---

 mm/oom_kill.c |   35 +++++++++++++++++++++++++----------
 1 file changed, 25 insertions(+), 10 deletions(-)

--- a/mm/oom_kill.c~mm-oom_kill-set-oc-constraint-in-constrained_alloc
+++ a/mm/oom_kill.c
@@ -254,29 +254,37 @@ static enum oom_constraint constrained_a
 	struct zone *zone;
 	struct zoneref *z;
 	enum zone_type high_zoneidx = gfp_zone(oc->gfp_mask);
+	enum oom_constraint constraint;
 	bool cpuset_limited = false;
 	int nid;
 
 	if (is_memcg_oom(oc)) {
 		oc->totalpages = mem_cgroup_get_max(oc->memcg) ?: 1;
-		return CONSTRAINT_MEMCG;
+		constraint = CONSTRAINT_MEMCG;
+		goto out;
 	}
 
 	/* Default to all available memory */
 	oc->totalpages = totalram_pages() + total_swap_pages;
 
-	if (!IS_ENABLED(CONFIG_NUMA))
-		return CONSTRAINT_NONE;
+	if (!IS_ENABLED(CONFIG_NUMA)) {
+		constraint = CONSTRAINT_NONE;
+		goto out;
+	}
 
-	if (!oc->zonelist)
-		return CONSTRAINT_NONE;
+	if (!oc->zonelist) {
+		constraint = CONSTRAINT_NONE;
+		goto out;
+	}
 	/*
 	 * Reach here only when __GFP_NOFAIL is used. So, we should avoid
 	 * to kill current.We have to random task kill in this case.
 	 * Hopefully, CONSTRAINT_THISNODE...but no way to handle it, now.
 	 */
-	if (oc->gfp_mask & __GFP_THISNODE)
-		return CONSTRAINT_NONE;
+	if (oc->gfp_mask & __GFP_THISNODE) {
+		constraint = CONSTRAINT_NONE;
+		goto out;
+	}
 
 	/*
 	 * This is not a __GFP_THISNODE allocation, so a truncated nodemask in
@@ -288,7 +296,8 @@ static enum oom_constraint constrained_a
 		oc->totalpages = total_swap_pages;
 		for_each_node_mask(nid, *oc->nodemask)
 			oc->totalpages += node_spanned_pages(nid);
-		return CONSTRAINT_MEMORY_POLICY;
+		constraint = CONSTRAINT_MEMORY_POLICY;
+		goto out;
 	}
 
 	/* Check this allocation failure is caused by cpuset's wall function */
@@ -301,9 +310,15 @@ static enum oom_constraint constrained_a
 		oc->totalpages = total_swap_pages;
 		for_each_node_mask(nid, cpuset_current_mems_allowed)
 			oc->totalpages += node_spanned_pages(nid);
-		return CONSTRAINT_CPUSET;
+		constraint = CONSTRAINT_CPUSET;
+		goto out;
 	}
-	return CONSTRAINT_NONE;
+
+	constraint = CONSTRAINT_NONE;
+
+out:
+	oc->constraint = constraint;
+	return constraint;
 }
 
 static int oom_evaluate_task(struct task_struct *task, void *arg)
_

Patches currently in -mm which might be from laoar.shao@xxxxxxxxx are

mm-vmscan-expose-cgroup_ino-for-memcg-reclaim-tracepoints.patch
mm-compaction-clear-total_migratefree_scanned-before-scanning-a-new-zone.patch
mm-compaction-clear-total_migratefree_scanned-before-scanning-a-new-zone-fix.patch




[Index of Archives]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux