From mboxrd@z Thu Jan 1 00:00:00 1970 From: Oleg Nesterov Subject: Re: [PATCH 2/4] percpu-rwsem: introduce percpu_rwsem_release() and percpu_rwsem_acquire() Date: Mon, 3 Aug 2015 17:40:01 +0200 Message-ID: <20150803154001.GA14649@redhat.com> References: <20150722211513.GA19986@redhat.com> <20150722211535.GA20007@redhat.com> <20150731102057.GV25159@twins.programming.kicks-ass.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Al Viro , Dave Chinner , Dave Hansen , Jan Kara , "Paul E. McKenney" , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org To: Peter Zijlstra Return-path: Received: from mx1.redhat.com ([209.132.183.28]:54986 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753216AbbHCPmG (ORCPT ); Mon, 3 Aug 2015 11:42:06 -0400 Content-Disposition: inline In-Reply-To: <20150731102057.GV25159@twins.programming.kicks-ass.net> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On 07/31, Peter Zijlstra wrote: > > On Wed, Jul 22, 2015 at 11:15:35PM +0200, Oleg Nesterov wrote: > > + > > +static inline void percpu_rwsem_release(struct percpu_rw_semaphore *sem, > > + bool read, unsigned long ip) > > +{ > > + lock_release(&sem->rw_sem.dep_map, 1, ip); > > +#ifdef CONFIG_RWSEM_SPIN_ON_OWNER > > + if (!read) > > + sem->rw_sem.owner = NULL; > > +#endif > > +} > > + > > +static inline void percpu_rwsem_acquire(struct percpu_rw_semaphore *sem, > > + bool read, unsigned long ip) > > +{ > > + lock_acquire(&sem->rw_sem.dep_map, 0, 1, read, 1, NULL, ip); > > +} > > This is of course entirely vile.. Can't we open code that in the freezer > code? Move these helpers somewhere in fs/super.c ? I don't think we should. All members in struct percpu_rw_semaphore are private, nobody outside of percpu-rwsem.[ch] should touch ->rw_sem at least. > Having helpers here might give some people the impression that > this is a sane thing to do. Yes, but this doesn't differ from other lockdep release/acquire helpers, they should be used with care. BTW, we also need these helpers to add the multi-writer support, but this is almost off-topic right now. > Also, when you do that in the freezer, put a big honking comment on it. OK, I'll update the comment(s). Oleg.