[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20190920143123.GI2507@uranus.lan>
Date: Fri, 20 Sep 2019 17:31:23 +0300
From: Cyrill Gorcunov <gorcunov@...il.com>
To: Kirill Tkhai <ktkhai@...tuozzo.com>
Cc: LKML <linux-kernel@...r.kernel.org>, Linux MM <linux-mm@...ck.org>,
Johannes Weiner <hannes@...xchg.org>,
Michal Hocko <mhocko@...nel.org>,
Vladimir Davydov <vdavydov.dev@...il.com>
Subject: Re: [PATCH] mm, memcg: assign shrinker_map before kvfree
On Fri, Sep 20, 2019 at 05:11:00PM +0300, Kirill Tkhai wrote:
>
> The current scheme is following. We allocate shrinker_map in css_online,
> while normal freeing happens in css_free. The NULLifying of pointer is needed
> in case of "abnormal freeing", when memcg_free_shrinker_maps() is called
> from memcg_alloc_shrinker_maps(). The NULLifying guarantees, we won't free
> pn->shrinker_map twice.
>
> There are no races or problems with kvfree() and rcu_assign_pointer() order,
> because of nobody can reference shrinker_map before memcg is online.
>
> In case of this rcu_assign_pointer() confuses, we may just remove is from
> the function, and call it only on css_free. Something like the below:
Kirill, I know that there is no problem now (as I pointed in changelog),
simply a regular pattern of free after assign is being reversed, which
made me nervious. Anyway dropping assigns doesn't help much from my pov
so lets leave it as is. The good point is that we've this conversation
and if someone get a bit confused in future the google will reveal this
text. Which is enough I think.
Powered by blists - more mailing lists