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

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

 



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) {
>                                     memcg = root;
>                                     mem_cgroup_iter_update(iter, NULL, memcg, root,  seq);
>                                     goto out_unlock:
>                               }
>               }
>               mem_cgroup_iter_update(iter, last_visited, memcg, root,
>                                 seq);
>               if (!prev && memcg)
>                         reclaim->generation = iter->generation;
> }
> 
> This is literally manual unwinding the second while loop, and thus omit
> the while loop,
> to save a   mem_cgroup_iter_update() and a mem_cgroup_iter_update()
> 
> But it maybe a bit hard to read.

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

Thanks!
-- 
Michal Hocko
SUSE Labs

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxx.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]