Thread (38 messages) 38 messages, 4 authors, 2009-03-13

Re: [PATCH 4/4] Memory controller soft limit reclaim on contention (v5)

From: KAMEZAWA Hiroyuki <hidden>
Date: 2009-03-13 08:41:07

Balbir Singh wrote:
* KAMEZAWA Hiroyuki [off-list ref] [2009-03-13
15:51:25]:
quoted
Balbir Singh wrote:
quoted
Feature: Implement reclaim from groups over their soft limit

From: Balbir Singh <redacted>
quoted
+unsigned long mem_cgroup_soft_limit_reclaim(struct zonelist *zl,
gfp_t
quoted
gfp_mask)
+{
+	unsigned long nr_reclaimed = 0;
+	struct mem_cgroup *mem;
+	unsigned long flags;
+	unsigned long reclaimed;
+
+	/*
+	 * This loop can run a while, specially if mem_cgroup's continuously
+	 * keep exceeding their soft limit and putting the system under
+	 * pressure
+	 */
+	do {
+		mem = mem_cgroup_largest_soft_limit_node();
+		if (!mem)
+			break;
+
+		reclaimed = mem_cgroup_hierarchical_reclaim(mem, zl,
+						gfp_mask,
+						MEM_CGROUP_RECLAIM_SOFT);
+		nr_reclaimed += reclaimed;
+		spin_lock_irqsave(&memcg_soft_limit_tree_lock, flags);
+		mem->usage_in_excess = res_counter_soft_limit_excess(&mem->res);
+		__mem_cgroup_remove_exceeded(mem);
+		if (mem->usage_in_excess)
+			__mem_cgroup_insert_exceeded(mem);
+		spin_unlock_irqrestore(&memcg_soft_limit_tree_lock, flags);
+		css_put(&mem->css);
+		cond_resched();
+	} while (!nr_reclaimed);
+	return nr_reclaimed;
+}
+
 Why do you never consider bad corner case....
 As I wrote many times, "order of global usage" doesn't mean the
 biggest user of memcg containes memory in zones which we want.
 So, please don't pust "mem" back to RB-tree if reclaimed is 0.

 This routine seems toooo bad as v4.
Are you talking about cases where a particular mem cgroup never
allocated from a node? Thanks.. let me take a look at it
Using cpuset to test and limiting nodes for memory is an easy way,

Thanks,
-Kame

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help