public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Oleg Nesterov <oleg@redhat.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Al Viro <viro@zeniv.linux.org.uk>,
	Dave Chinner <david@fromorbit.com>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	Jan Kara <jack@suse.cz>,
	"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>,
	linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/4] percpu-rwsem: introduce percpu_rwsem_release() and percpu_rwsem_acquire()
Date: Mon, 3 Aug 2015 17:40:01 +0200	[thread overview]
Message-ID: <20150803154001.GA14649@redhat.com> (raw)
In-Reply-To: <20150731102057.GV25159@twins.programming.kicks-ass.net>

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.


  reply	other threads:[~2015-08-03 15:42 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-22 21:15 [PATCH 0/4] change sb_writers to use percpu_rw_semaphore Oleg Nesterov
2015-07-22 21:15 ` [PATCH 1/4] percpu-rwsem: introduce percpu_down_read_trylock() Oleg Nesterov
2015-07-22 21:15 ` [PATCH 2/4] percpu-rwsem: introduce percpu_rwsem_release() and percpu_rwsem_acquire() Oleg Nesterov
2015-07-31 10:20   ` Peter Zijlstra
2015-08-03 15:40     ` Oleg Nesterov [this message]
2015-07-22 21:15 ` [PATCH 3/4] shift percpu_counter_destroy() into destroy_super_work() Oleg Nesterov
2015-07-28  8:36   ` Jan Kara
2015-07-22 21:15 ` [PATCH 4/4] change sb_writers to use percpu_rw_semaphore Oleg Nesterov
2015-07-22 21:34   ` Oleg Nesterov
2015-07-28  8:34   ` Jan Kara
2015-08-03 17:30     ` Oleg Nesterov
2015-08-07 19:54   ` Oleg Nesterov
2015-08-07 19:55 ` [PATCH 0/4] " Oleg Nesterov
2015-08-10 14:59   ` Jan Kara
2015-08-10 22:41     ` Dave Chinner
2015-08-11 13:16       ` Oleg Nesterov
2015-08-11 13:29         ` Jan Kara

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150803154001.GA14649@redhat.com \
    --to=oleg@redhat.com \
    --cc=dave.hansen@linux.intel.com \
    --cc=david@fromorbit.com \
    --cc=jack@suse.cz \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=paulmck@linux.vnet.ibm.com \
    --cc=peterz@infradead.org \
    --cc=viro@zeniv.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox