Re: [PATCH] memcg: put soft limit reclaim out of way if the excess tree is empty
From: Michal Hocko
Date: Mon Aug 01 2016 - 10:12:53 EST
On Mon 01-08-16 16:57:57, Vladimir Davydov wrote:
> On Mon, Aug 01, 2016 at 12:00:21PM +0200, Michal Hocko wrote:
> ...
> > diff --git a/mm/memcontrol.c b/mm/memcontrol.c
> > index c265212bec8c..eb7e39c2d948 100644
> > --- a/mm/memcontrol.c
> > +++ b/mm/memcontrol.c
> > @@ -2543,6 +2543,11 @@ static int mem_cgroup_resize_memsw_limit(struct mem_cgroup *memcg,
> > return ret;
> > }
> >
> > +static inline bool soft_limit_tree_empty(struct mem_cgroup_tree_per_node *mctz)
> > +{
> > + return rb_last(&mctz->rb_root) == NULL;
> > +}
> > +
>
> I don't think traversing rb tree as rb_last() does w/o holding the lock
> is a good idea. Why is RB_EMPTY_ROOT() insufficient here?
Of course it is not. Dohh, forgot to refresh the patch! Sorry about
that.
Updated patch.
---