From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.linuxfoundation.org ([140.211.169.12]:43978 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731193AbeGRDOP (ORCPT ); Tue, 17 Jul 2018 23:14:15 -0400 Date: Tue, 17 Jul 2018 19:38:41 -0700 From: Andrew Morton To: Omar Sandoval Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, Alexey Dobriyan , Eric Biederman , James Morse , Bhupesh Sharma , kernel-team@fb.com Subject: Re: [PATCH v2 2/7] proc/kcore: replace kclist_lock rwlock with rwsem Message-Id: <20180717193841.271d1c57b6f88d75c83892be@linux-foundation.org> In-Reply-To: <783ba3becc424db45e5d5c93559fc40ef6173f01.1531440458.git.osandov@fb.com> References: <783ba3becc424db45e5d5c93559fc40ef6173f01.1531440458.git.osandov@fb.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On Thu, 12 Jul 2018 17:09:34 -0700 Omar Sandoval wrote: > From: Omar Sandoval > > Now we only need kclist_lock from user context and at fs init time, and > the following changes need to sleep while holding the kclist_lock. > > ... > > --- a/fs/proc/kcore.c > +++ b/fs/proc/kcore.c > @@ -59,8 +59,8 @@ struct memelfnote > }; > > static LIST_HEAD(kclist_head); > -static DEFINE_RWLOCK(kclist_lock); > -static int kcore_need_update = 1; > +static DECLARE_RWSEM(kclist_lock); > +static atomic_t kcore_need_update = ATOMIC_INIT(1); It's unclear why kcore_need_update was changed to atomic_t - it's still updated under kclist_lock? Maybe it's for a later patch.