Re: [PATCH 1/2] mm/memcontrol.c: remove meaningless while loop in mem_cgroup_iter()

2014-04-22 Thread Jianyu Zhan
On Tue, Apr 22, 2014 at 7:48 PM, Michal Hocko wrote: > Dunno, this particular case is more explicit but it is also uglier so I > do not think this is an overall improvement. I would rather keep the > current state unless the change either simplifies the generated code > or it is much better to rea

Re: [PATCH 1/2] mm/memcontrol.c: remove meaningless while loop in mem_cgroup_iter()

2014-04-22 Thread Michal Hocko
On Tue 22-04-14 18:58:11, Jianyu Zhan wrote: [...] > This reminds me of my draft edition of this patch, I specifically handle > this case as: > > if (reclaim) { >if (!memcg ) { > iter->generation++; > if (!prev) { >

Re: [PATCH 1/2] mm/memcontrol.c: remove meaningless while loop in mem_cgroup_iter()

2014-04-22 Thread Jianyu Zhan
On Tue, Apr 22, 2014 at 6:34 PM, Michal Hocko wrote: > Sorry, I should have been more specific that I was talking about > mem_cgroup_reclaim_cookie path where the iteration for this particular > zone and priority ended at the last node without finishing the full > roundtrip last time. This new ite

Re: [PATCH 1/2] mm/memcontrol.c: remove meaningless while loop in mem_cgroup_iter()

2014-04-22 Thread Michal Hocko
On Tue 22-04-14 18:17:09, Jianyu Zhan wrote: > On Tue, Apr 22, 2014 at 5:47 PM, Michal Hocko wrote: > > What about > > 3. last_visited == last_node in the tree > > > > __mem_cgroup_iter_next returns NULL and the iterator would return > > without visiting anything. > > Hi, Michal, > > yep, if

Re: [PATCH 1/2] mm/memcontrol.c: remove meaningless while loop in mem_cgroup_iter()

2014-04-22 Thread Jianyu Zhan
On Tue, Apr 22, 2014 at 5:47 PM, Michal Hocko wrote: > What about > 3. last_visited == last_node in the tree > > __mem_cgroup_iter_next returns NULL and the iterator would return > without visiting anything. Hi, Michal, yep, if 3 last_visited == last_node, then this means we have done a roun

Re: [PATCH 1/2] mm/memcontrol.c: remove meaningless while loop in mem_cgroup_iter()

2014-04-22 Thread Michal Hocko
On Sat 19-04-14 06:58:55, Jianyu Zhan wrote: > Currently, the iteration job in mem_cgroup_iter() all delegates > to __mem_cgroup_iter_next(), which will skip dead node. > > Thus, the outer while loop in mem_cgroup_iter() is meaningless. > It could be proven by this: > > 1. memcg != NULL > we

[PATCH 1/2] mm/memcontrol.c: remove meaningless while loop in mem_cgroup_iter()

2014-04-18 Thread Jianyu Zhan
Currently, the iteration job in mem_cgroup_iter() all delegates to __mem_cgroup_iter_next(), which will skip dead node. Thus, the outer while loop in mem_cgroup_iter() is meaningless. It could be proven by this: 1. memcg != NULL we are done, no loop needed. 2. memcg == NULL 2.1 prev != NUL