The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Andy Whitcroft <apw@shadowen.org>
To: Pavel Roskin <proski@gnu.org>
Cc: Christoph Hellwig <hch@infradead.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Pekka Paalanen <pq@iki.fi>,
	linux-kernel@vger.kernel.org, Ingo Molnar <mingo@elte.hu>,
	Arjan van de Ven <arjan@infradead.org>,
	Steven Rostedt <rostedt@goodmis.org>,
	Peter Zijlstra <a.p.zijlstra@chello.nl>
Subject: Re: [RFC] mmiotrace full patch, preview 1
Date: Tue, 26 Feb 2008 08:57:35 +0000	[thread overview]
Message-ID: <20080226085735.GC20322@shadowen.org> (raw)
In-Reply-To: <20080225214200.yge03wi7ksoccw0k@webmail.spamcop.net>

On Mon, Feb 25, 2008 at 09:42:00PM -0500, Pavel Roskin wrote:
> Quoting Christoph Hellwig <hch@infradead.org>:
> 
> >On Mon, Feb 25, 2008 at 02:49:22PM -0800, Andrew Morton wrote:
> >>the things which it finds.
> >>
> >>> +static DECLARE_MUTEX(kmmio_init_mutex);
> >>
> >>That's not a mutex.
> >>
> >>> +	down(&kmmio_init_mutex);
> >>
> >>It's a semaphore.  Please do convert it to a mutex.
> >>
> >>Andy, I'd say that addition of new semaphores is worth a warning - they're
> >>rarely legitimate.
> >
> >I'm not sure that any semaphore should be a warning, but the initializer
> >for semaphore used as binary mutex (DECLARE_MUTEX and init_MUTEX) are
> >worth it.
> 
> It looks like a mutex, it acts like a mutex, but it isn't a mutex,  
> it's a trap for the unwary.  Weird.  I was annoyed by it before; now I  
> see a fellow developer actually getting into that trap.
> 
> I'd say, rename DECLARE_MUTEX to DECLARE_SEMAPHORE and let external  
> code be fixed one way or another (i.e. stick with the "mutex" name or  
> stick with the semaphore functionality if it's really needed).

I like the fact that in evey architecture its defined as:

	#define DECLARE_MUTEX(name) __DECLARE_SEMAPHORE_GENERIC(name,1)

-apw

  reply	other threads:[~2008-02-26  8:57 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-24 17:03 [RFC] mmiotrace full patch, preview 1 Pekka Paalanen
2008-02-24 17:59 ` Sam Ravnborg
2008-02-25 22:49 ` Andrew Morton
2008-02-25 23:34   ` Christoph Hellwig
2008-02-26  2:42     ` Pavel Roskin
2008-02-26  8:57       ` Andy Whitcroft [this message]
2008-02-26 17:10       ` Christoph Hellwig
2008-02-26 10:21     ` Andy Whitcroft
2008-02-26 10:49       ` Ingo Molnar
2008-02-26 15:20         ` Andy Whitcroft
2008-02-26 20:02   ` Pekka Paalanen
2008-02-26 17:20 ` Jonathan Corbet
2008-02-27 20:28   ` Pekka Paalanen

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=20080226085735.GC20322@shadowen.org \
    --to=apw@shadowen.org \
    --cc=a.p.zijlstra@chello.nl \
    --cc=akpm@linux-foundation.org \
    --cc=arjan@infradead.org \
    --cc=hch@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=pq@iki.fi \
    --cc=proski@gnu.org \
    --cc=rostedt@goodmis.org \
    /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