All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michal Hocko <mhocko@suse.cz>
To: Andrew Morton <akpm@linux-foundation.org>,
	Johannes Weiner <hannes@cmpxchg.org>,
	KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: linux-mm@kvack.org, cgroups@vger.kernel.org,
	linux-kernel@vger.kernel.org, Ying Han <yinghan@google.com>,
	Hugh Dickins <hughd@google.com>,
	Glauber Costa <glommer@parallels.com>,
	Michel Lespinasse <walken@google.com>,
	Greg Thelen <gthelen@google.com>, Tejun Heo <tj@kernel.org>,
	Balbir Singh <bsingharora@gmail.com>
Subject: Re: [patch -v4 4/8] memcg: enhance memcg iterator to support predicates
Date: Mon, 10 Jun 2013 09:48:54 +0200	[thread overview]
Message-ID: <20130610074854.GA5138@dhcp22.suse.cz> (raw)
In-Reply-To: <1370254735-13012-5-git-send-email-mhocko@suse.cz>

Just for the record. I squash the following doc update to the patch in
the next version.
---
diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h
index 811967a..9ca85ff 100644
--- a/include/linux/memcontrol.h
+++ b/include/linux/memcontrol.h
@@ -42,11 +42,19 @@ struct mem_cgroup_reclaim_cookie {
 };
 
 enum mem_cgroup_filter_t {
-	VISIT,
-	SKIP,
-	SKIP_TREE,
+	VISIT,		/* visit current node */
+	SKIP,		/* skip the current node and continue traversal */
+	SKIP_TREE,	/* skip the whole subtree and continue traversal */
 };
 
+/*
+ * mem_cgroup_filter_t predicate might instruct mem_cgroup_iter_cond how to
+ * iterate through the hierarchy tree. Each tree element is checked by the
+ * predicate before it is returned by the iterator. If a filter returns
+ * SKIP or SKIP_TREE then the iterator code continues traversal (with the
+ * next node down the hierarchy or the next node that doesn't belong under the
+ * memcg's subtree).
+ */
 typedef enum mem_cgroup_filter_t
 (*mem_cgroup_iter_filter)(struct mem_cgroup *memcg, struct mem_cgroup *root);
 
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 91740f7..43e955a 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -1073,6 +1073,14 @@ skip_node:
 			prev_cgroup = next_cgroup;
 			goto skip_node;
 		case SKIP_TREE:
+			/*
+			 * cgroup_rightmost_descendant is not an optimal way to
+			 * skip through a subtree (especially for imbalanced
+			 * trees leaning to right) but that's what we have right
+			 * now. More effective solution would be traversing
+			 * right-up for first non-NULL without calling
+			 * cgroup_next_descendant_pre afterwards.
+			 */
 			prev_cgroup = cgroup_rightmost_descendant(next_cgroup);
 			goto skip_node;
 		case VISIT:
-- 
Michal Hocko
SUSE Labs

--
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>

WARNING: multiple messages have this Message-ID (diff)
From: Michal Hocko <mhocko@suse.cz>
To: Andrew Morton <akpm@linux-foundation.org>,
	Johannes Weiner <hannes@cmpxchg.org>,
	KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: linux-mm@kvack.org, cgroups@vger.kernel.org,
	linux-kernel@vger.kernel.org, Ying Han <yinghan@google.com>,
	Hugh Dickins <hughd@google.com>,
	Glauber Costa <glommer@parallels.com>,
	Michel Lespinasse <walken@google.com>,
	Greg Thelen <gthelen@google.com>, Tejun Heo <tj@kernel.org>,
	Balbir Singh <bsingharora@gmail.com>
Subject: Re: [patch -v4 4/8] memcg: enhance memcg iterator to support predicates
Date: Mon, 10 Jun 2013 09:48:54 +0200	[thread overview]
Message-ID: <20130610074854.GA5138@dhcp22.suse.cz> (raw)
In-Reply-To: <1370254735-13012-5-git-send-email-mhocko@suse.cz>

Just for the record. I squash the following doc update to the patch in
the next version.
---
diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h
index 811967a..9ca85ff 100644
--- a/include/linux/memcontrol.h
+++ b/include/linux/memcontrol.h
@@ -42,11 +42,19 @@ struct mem_cgroup_reclaim_cookie {
 };
 
 enum mem_cgroup_filter_t {
-	VISIT,
-	SKIP,
-	SKIP_TREE,
+	VISIT,		/* visit current node */
+	SKIP,		/* skip the current node and continue traversal */
+	SKIP_TREE,	/* skip the whole subtree and continue traversal */
 };
 
+/*
+ * mem_cgroup_filter_t predicate might instruct mem_cgroup_iter_cond how to
+ * iterate through the hierarchy tree. Each tree element is checked by the
+ * predicate before it is returned by the iterator. If a filter returns
+ * SKIP or SKIP_TREE then the iterator code continues traversal (with the
+ * next node down the hierarchy or the next node that doesn't belong under the
+ * memcg's subtree).
+ */
 typedef enum mem_cgroup_filter_t
 (*mem_cgroup_iter_filter)(struct mem_cgroup *memcg, struct mem_cgroup *root);
 
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 91740f7..43e955a 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -1073,6 +1073,14 @@ skip_node:
 			prev_cgroup = next_cgroup;
 			goto skip_node;
 		case SKIP_TREE:
+			/*
+			 * cgroup_rightmost_descendant is not an optimal way to
+			 * skip through a subtree (especially for imbalanced
+			 * trees leaning to right) but that's what we have right
+			 * now. More effective solution would be traversing
+			 * right-up for first non-NULL without calling
+			 * cgroup_next_descendant_pre afterwards.
+			 */
 			prev_cgroup = cgroup_rightmost_descendant(next_cgroup);
 			goto skip_node;
 		case VISIT:
-- 
Michal Hocko
SUSE Labs

  parent reply	other threads:[~2013-06-10  7:48 UTC|newest]

Thread overview: 63+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-03 10:18 [patch v4] Soft limit rework Michal Hocko
2013-06-03 10:18 ` Michal Hocko
2013-06-03 10:18 ` [patch -v4 1/8] memcg: integrate soft reclaim tighter with zone shrinking code Michal Hocko
2013-06-03 10:18   ` Michal Hocko
2013-06-03 10:18 ` [patch -v4 2/8] memcg: Get rid of soft-limit tree infrastructure Michal Hocko
2013-06-03 10:18   ` Michal Hocko
2013-06-03 10:18 ` [patch -v4 3/8] vmscan, memcg: Do softlimit reclaim also for targeted reclaim Michal Hocko
2013-06-03 10:18   ` Michal Hocko
2013-06-03 10:18   ` Michal Hocko
2013-06-03 10:18 ` [patch -v4 4/8] memcg: enhance memcg iterator to support predicates Michal Hocko
2013-06-03 10:18   ` Michal Hocko
     [not found]   ` <1370254735-13012-5-git-send-email-mhocko-AlSwsSmVLrQ@public.gmane.org>
2013-06-04  1:07     ` Tejun Heo
2013-06-04  1:07       ` Tejun Heo
2013-06-04  1:07       ` Tejun Heo
2013-06-04 13:45       ` Michal Hocko
2013-06-04 13:45         ` Michal Hocko
2013-06-04 19:36         ` Tejun Heo
2013-06-04 19:36           ` Tejun Heo
     [not found]           ` <20130604193619.GA14916-Gd/HAXX7CRxy/B6EtB590w@public.gmane.org>
2013-06-04 20:48             ` Michal Hocko
2013-06-04 20:48               ` Michal Hocko
2013-06-04 20:48               ` Michal Hocko
2013-06-04 20:54               ` Tejun Heo
2013-06-04 20:54                 ` Tejun Heo
2013-06-05  7:37                 ` Michal Hocko
2013-06-05  7:37                   ` Michal Hocko
2013-06-05  8:05                   ` Tejun Heo
2013-06-05  8:05                     ` Tejun Heo
2013-06-05  8:52                     ` Michal Hocko
2013-06-05  8:52                       ` Michal Hocko
2013-06-05  8:58                       ` Tejun Heo
2013-06-05  8:58                         ` Tejun Heo
2013-06-05  9:07                         ` Michal Hocko
2013-06-05  9:07                           ` Michal Hocko
2013-06-05  9:09                           ` Tejun Heo
2013-06-05  9:09                             ` Tejun Heo
2013-06-07  0:48                             ` Tejun Heo
2013-06-07  0:48                               ` Tejun Heo
2013-06-07  8:25                               ` Michal Hocko
2013-06-07  8:25                                 ` Michal Hocko
2013-06-10  7:48   ` Michal Hocko [this message]
2013-06-10  7:48     ` Michal Hocko
2013-06-03 10:18 ` [patch -v4 5/8] memcg: track children in soft limit excess to improve soft limit Michal Hocko
2013-06-03 10:18   ` Michal Hocko
2013-06-03 10:18 ` [patch -v4 6/8] memcg, vmscan: Do not attempt soft limit reclaim if it would not scan anything Michal Hocko
2013-06-03 10:18   ` Michal Hocko
2013-06-03 10:18 ` [patch -v4 7/8] memcg: Track all children over limit in the root Michal Hocko
2013-06-03 10:18   ` Michal Hocko
2013-06-03 10:18 ` [patch -v4 8/8] memcg, vmscan: do not fall into reclaim-all pass too quickly Michal Hocko
2013-06-03 10:18   ` Michal Hocko
     [not found] ` <1370254735-13012-1-git-send-email-mhocko-AlSwsSmVLrQ@public.gmane.org>
2013-06-04 16:27   ` [patch v4] Soft limit rework Balbir Singh
2013-06-04 16:27     ` Balbir Singh
2013-06-04 16:27     ` Balbir Singh
2013-06-04 16:38     ` Michal Hocko
2013-06-04 16:38       ` Michal Hocko
2013-06-04 17:57       ` Balbir Singh
2013-06-04 17:57         ` Balbir Singh
2013-06-04 18:08         ` Michal Hocko
2013-06-04 18:08           ` Michal Hocko
2013-06-11 15:43   ` Michal Hocko
2013-06-11 15:43     ` Michal Hocko
2013-06-11 15:43     ` Michal Hocko
2013-06-17 14:01     ` Michal Hocko
2013-06-17 14:01       ` Michal Hocko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130610074854.GA5138@dhcp22.suse.cz \
    --to=mhocko@suse.cz \
    --cc=akpm@linux-foundation.org \
    --cc=bsingharora@gmail.com \
    --cc=cgroups@vger.kernel.org \
    --cc=glommer@parallels.com \
    --cc=gthelen@google.com \
    --cc=hannes@cmpxchg.org \
    --cc=hughd@google.com \
    --cc=kamezawa.hiroyu@jp.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=tj@kernel.org \
    --cc=walken@google.com \
    --cc=yinghan@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.