Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752429AbcLERhX (ORCPT ); Mon, 5 Dec 2016 12:37:23 -0500 Received: from mx2.suse.de ([195.135.220.15]:56066 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752333AbcLERhT (ORCPT ); Mon, 5 Dec 2016 12:37:19 -0500 Date: Mon, 5 Dec 2016 09:37:02 -0800 From: Davidlohr Bueso To: Oleg Nesterov Cc: Peter Zijlstra , mingo@kernel.org, john.stultz@linaro.org, dimitrysh@google.com, linux-kernel@vger.kernel.org, Davidlohr Bueso Subject: Re: [PATCH v2 2/3] locking/percpu-rwsem: Rework writer block/wake to not use wait-queues Message-ID: <20161205173702.GA23348@linux-80c1.suse> References: <1479495277-9075-1-git-send-email-dave@stgolabs.net> <1479495277-9075-3-git-send-email-dave@stgolabs.net> <20161203021839.GB30078@linux-80c1.suse> <20161205083605.GQ3092@twins.programming.kicks-ass.net> <20161205112636.GA30280@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <20161205112636.GA30280@redhat.com> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 910 Lines: 24 On Mon, 05 Dec 2016, Oleg Nesterov wrote: >Yes. But percpu_down_write() should not be used after exit_notify(), so we >can rely on rcu_read_lock(), release_task()->call_rcu(delayed_put_task_struct) >can't be called until an exiting task passes exit_notify(). > >But then we probably need WARN_ON(current->exit_state) in percpu_down_write(). Hmm, my immediate thought would have been doing a PF_EXITING check, but of course this enlarges the window of the warn being triggered, yet maintains what you are saying in that percpu_down_write should not be used after do_exit/exit_notify. Furthermore, reading the comment in task_rcu_dereference, I get your point and we can loose the reference to the task, iow busted rcu read cr. > >And personally I think this change should add the new helpers, they can have >more users. Something like > > struct xxx { What do you think of s/xxx/rcuwait? Thanks, Davidlohr