[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.20.1709051013380.1900@nanos>
Date: Tue, 5 Sep 2017 10:19:13 +0200 (CEST)
From: Thomas Gleixner <tglx@...utronix.de>
To: Michal Hocko <mhocko@...nel.org>
cc: Johannes Weiner <hannes@...xchg.org>,
Artem Savkov <asavkov@...hat.com>,
"Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>,
LKML <linux-kernel@...r.kernel.org>, linux-mm@...ck.org
Subject: Re: possible circular locking dependency
mmap_sem/cpu_hotplug_lock.rw_sem
On Mon, 4 Sep 2017, Michal Hocko wrote:
> Thomas, Johannes,
> could you double check my thinking here? I will repost the patch to
> Andrew if you are OK with this.
> > + /*
> > + * The only protection from memory hotplug vs. drain_stock races is
> > + * that we always operate on local CPU stock here with IRQ disabled
> > + */
> > local_irq_save(flags);
> >
> > stock = this_cpu_ptr(&memcg_stock);
> > @@ -1807,26 +1811,27 @@ static void drain_all_stock(struct mem_cgroup *root_memcg)
> > if (!mutex_trylock(&percpu_charge_mutex))
> > return;
> > /* Notify other cpus that system-wide "drain" is running */
> > - get_online_cpus();
> > curcpu = get_cpu();
The problem here is that this does only protect you against a CPU being
unplugged, but not against a CPU coming online concurrently. I have no idea
whether that might be a problem, but at least you should put a comment in
which explains why it is not.
Thanks,
tglx
Powered by blists - more mailing lists