[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.20.1707041449220.9000@nanos>
Date: Tue, 4 Jul 2017 14:49:47 +0200 (CEST)
From: Thomas Gleixner <tglx@...utronix.de>
To: Vlastimil Babka <vbabka@...e.cz>
cc: LKML <linux-kernel@...r.kernel.org>, linux-mm@...ck.org,
Andrey Ryabinin <aryabinin@...tuozzo.com>,
Michal Hocko <mhocko@...nel.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Vladimir Davydov <vdavydov.dev@...il.com>,
Peter Zijlstra <peterz@...radead.org>
Subject: Re: [patch V2 2/2] mm/memory-hotplug: Switch locking to a percpu
rwsem
On Tue, 4 Jul 2017, Vlastimil Babka wrote:
> On 07/04/2017 11:32 AM, Thomas Gleixner wrote:
> > Andrey reported a potential deadlock with the memory hotplug lock and the
> > cpu hotplug lock.
> >
> > The reason is that memory hotplug takes the memory hotplug lock and then
> > calls stop_machine() which calls get_online_cpus(). That's the reverse lock
> > order to get_online_cpus(); get_online_mems(); in mm/slub_common.c
> >
> > The problem has been there forever. The reason why this was never reported
> > is that the cpu hotplug locking had this homebrewn recursive reader writer
> > semaphore construct which due to the recursion evaded the full lock dep
> > coverage. The memory hotplug code copied that construct verbatim and
> > therefor has similar issues.
> >
> > Three steps to fix this:
> >
> > 1) Convert the memory hotplug locking to a per cpu rwsem so the potential
> > issues get reported proper by lockdep.
> >
> > 2) Lock the online cpus in mem_hotplug_begin() before taking the memory
> > hotplug rwsem and use stop_machine_cpuslocked() in the page_alloc code
> > and use to avoid recursive locking.
>
> ^ s/and use // ?
Ooops, yes.
Thanks,
tglx
Powered by blists - more mailing lists