From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932295AbbFWHRH (ORCPT ); Tue, 23 Jun 2015 03:17:07 -0400 Received: from bombadil.infradead.org ([198.137.202.9]:47944 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753977AbbFWHQw (ORCPT ); Tue, 23 Jun 2015 03:16:52 -0400 Date: Tue, 23 Jun 2015 09:16:37 +0200 From: Peter Zijlstra To: Oleg Nesterov Cc: paulmck@linux.vnet.ibm.com, tj@kernel.org, mingo@redhat.com, linux-kernel@vger.kernel.org, der.herr@hofr.at, dave@stgolabs.net, riel@redhat.com, viro@ZenIV.linux.org.uk, torvalds@linux-foundation.org Subject: Re: [RFC][PATCH 09/13] hotplug: Replace hotplug lock with percpu-rwsem Message-ID: <20150623071637.GA3644@twins.programming.kicks-ass.net> References: <20150622121623.291363374@infradead.org> <20150622122256.480062572@infradead.org> <20150622225739.GA5582@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150622225739.GA5582@redhat.com> User-Agent: Mutt/1.5.21 (2012-12-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jun 23, 2015 at 12:57:39AM +0200, Oleg Nesterov wrote: > > + > > + lock_map_acquire_read(&cpu_hotplug.rwsem.rw_sem.dep_map); > > + _percpu_down_read(&cpu_hotplug.rwsem); > > } > > Confused... Why do we need _percpu_down_read()? Can't get_online_cpus() > just use percpu_down_read() ? > > Yes, percpu_down_read() is not recursive, like the normal down_read(). > But this does not matter because we rely on ->cpuhp_ref anyway? While we will not call the actual lock, lockdep will still get confused by the inconsistent locking order observed. Change it and boot, you'll find lockdep output pretty quickly. > > --- a/kernel/fork.c > > +++ b/kernel/fork.c > > @@ -1410,6 +1410,8 @@ static struct task_struct *copy_process( > > p->sequential_io_avg = 0; > > #endif > > > > + cpu_hotplug_init_task(p); > > This is probably unnecessary, copy_process() should not be called under > get_online_cpus(). Probably true, in which case we could still use the callback to insert a WARN_ON_ONCE(p->cpuhp_ref) :-) -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in Please read the FAQ at http://www.tux.org/lkml/