Re: [PATCH] slub: Fix sysfs circular locking dependency
From: KAMEZAWA Hiroyuki
Date: Thu Jan 06 2011 - 19:17:11 EST
On Thu, 6 Jan 2011 12:10:59 -0600 (CST)
Christoph Lameter <cl@xxxxxxxxx> wrote:
> On Thu, 6 Jan 2011, David Rientjes wrote:
> > > Thanks for testing. David, does Christoph's patch look OK to you?
> > >
> > I think it certainly fixes the problem at hand, but I think we also need
> > to do lock_memory_hotplug() for memory hotplug in
> > slab_mem_going_online_callback() to make show_slab_objects() consistent
> > when being printed during concurrent node hot-add since it sets bits in
> > N_NORMAL_MEMORY. The MEM_OFFLINE callback is already handled at a higher
> > level by taking the lock in the hotplug layer, but we need to protect the
> > MEM_GOING_ONLINE and MEM_CANCEL_ONLINE callbacks if slub_lock is no longer
> > used to protect node arrays (which was admittedly always convenient since
> > it's typically associated with an iteration through slab_caches).
> Hmm, I would have expected the callbacks all to be done under hotplug
> The MEM_GOING_ONLINE callback is not that critical since a node that is
> coming online presumably has only a minimal set of objects necessary for
> potential future allocations.
> slab_mem_going_online_callback() etc already take the slub_lock since they
> have to iterate over the list of slab caches in existence. We could take
> the hotplug lock there as well.
> Kame-san: Can you enlighten us on hotplug locking? And also check this
IIRC, lock_memory_hotplug() is a new lock in 2.6.37 added by Kosaki
This lock is for avoiding race with hwpoison and memory hotplug and original
lock (before replacement) was for avoiding race with hibernation. online_pages()
was out of lock because it just makes PG_reserved page to be free page, not racy
But, nice catch. I think MEM_GOING_ONLINE, MEM_ONLINE should be done under
lock_memory_hotplug. So, could you update your patch and modify online_pages() ?
IIUC, online_pages() is an user interface function and there will be no downside
to insert lock there. online_pages() should be serialized.
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/