From: Michal Hocko <mhocko@suse.cz>
To: Tejun Heo <tj@kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Johannes Weiner <hannes@cmpxchg.org>,
KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>,
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>,
Balbir Singh <bsingharora@gmail.com>
Subject: Re: [patch -v4 4/8] memcg: enhance memcg iterator to support predicates
Date: Fri, 7 Jun 2013 10:25:02 +0200 [thread overview]
Message-ID: <20130607082502.GC8117@dhcp22.suse.cz> (raw)
In-Reply-To: <20130607004824.GA16160@htj.dyndns.org>
On Thu 06-06-13 17:48:24, Tejun Heo wrote:
> On Wed, Jun 05, 2013 at 02:09:38AM -0700, Tejun Heo wrote:
> > On Wed, Jun 05, 2013 at 11:07:39AM +0200, Michal Hocko wrote:
> > > On Wed 05-06-13 01:58:49, Tejun Heo wrote:
> > > [...]
> > > > Anyways, so you aren't gonna try the skipping thing?
> > >
> > > As I said. I do not consider this a priority for the said reasons (i
> > > will not repeat them).
> >
> > That's a weird way to respond. Alright, whatever, let me give it a
> > shot then.
>
> So, there were some private exchanges and here's my main issue with
> the addition of predicate callback to mem_cgroup_iter_cond().
>
> There are two common patterns that are used to implement iteration.
> One is the good ol' callback based one - ie. call_fn_on_each(fn) type
> interface. The other is something which can be used as part of flow
> control by the user - be it give_me_next_elem() or for_each() type
> loop macro. In majority of cases, especially for anything generic,
> the latter is considered to be the better choice because, while a bit
> more challenging to implement usually, it's a lot less cumbersome for
> the users of the interface.
>
> mem_cgroup_iter_cond() seems icky to me because the predicate callback
> is essentially visit callback,
OK, I thought that the predicate signature made it clear that its
purpose is to _check_ whether visiting makes sense rather than _visit_
that node and work with the node. That is the reason why I didn't
include state parameter which would be expected for the full visitor.
Maybe using const would make it even more clear. I can update
documentation for the predicate to make it more clear.
> so now we end up with give_me_next_elem() with visit callback, which
> is fundamentally superflous. If it were properly call_fn_on_each(fn),
> the return values would be CONTINUE, SKIP_SUBTREE or ABORT, which
> makes more sense to me. Sure, it can be said that the predicate
> callback is for a different purpose but it really doesn't change that
> the interface now is visiting the same node in two different places.
> If it were something remotely widely used, it won't take much time
> developing braindamaged usages where part is being done inside the
> predicate callback and the rest is done outside without clear reason
> why just because of natural code growth. I don't think this is the
> type of construct that we want in kernel in general.
>
> That said, it also is true that doing this is the shortest path to
> implementing subtree skip given how the iterator is put together
> currently and the series as a whole reduces significant amount of
> complexity, so it is an acceptable tradeoff to proceed with this
> implementation with later restructuring of the iterator.
Good. As I said many times, memcg iterators could see some clean ups.
> So, let's go ahead as proposed.
Thanks!
> I'll try to rework the iterator on top of it, and my aplogies to
> Michal for being over-the-top.
Thanks!
--
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>
next prev parent reply other threads:[~2013-06-07 8:25 UTC|newest]
Thread overview: 29+ 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 ` [patch -v4 1/8] memcg: integrate soft reclaim tighter with zone shrinking code 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 ` [patch -v4 3/8] vmscan, memcg: Do softlimit reclaim also for targeted reclaim Michal Hocko
2013-06-03 10:18 ` [patch -v4 4/8] memcg: enhance memcg iterator to support predicates Michal Hocko
2013-06-04 1:07 ` Tejun Heo
2013-06-04 13:45 ` Michal Hocko
2013-06-04 19:36 ` Tejun Heo
2013-06-04 20:48 ` Michal Hocko
2013-06-04 20:54 ` Tejun Heo
2013-06-05 7:37 ` Michal Hocko
2013-06-05 8:05 ` Tejun Heo
2013-06-05 8:52 ` Michal Hocko
2013-06-05 8:58 ` Tejun Heo
2013-06-05 9:07 ` Michal Hocko
2013-06-05 9:09 ` Tejun Heo
2013-06-07 0:48 ` Tejun Heo
2013-06-07 8:25 ` 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 ` [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 ` [patch -v4 7/8] memcg: Track all children over limit in the root 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-04 16:27 ` [patch v4] Soft limit rework Balbir Singh
2013-06-04 16:38 ` Michal Hocko
2013-06-04 17:57 ` Balbir Singh
2013-06-04 18:08 ` Michal Hocko
2013-06-11 15:43 ` 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=20130607082502.GC8117@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox