mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jody McIntyre <scjody@modernduck.com>
To: Matthew Wilcox <matthew@wil.cx>
Cc: Andrew Morton <akpm@osdl.org>,
	linux-kernel@vger.kernel.org, willy@debian.org, nathans@sgi.com
Subject: Re: [PATCH, RFC 1/3] Add sem_getcount() to arches that lack it
Date: Fri, 11 Mar 2005 12:04:49 -0500	[thread overview]
Message-ID: <20050311170449.GS1111@conscoop.ottawa.on.ca> (raw)
In-Reply-To: <20050311122747.GL21986@parcelfarce.linux.theplanet.co.uk>

On Fri, Mar 11, 2005 at 12:27:47PM +0000, Matthew Wilcox wrote:

> > But I guess it's a bit hard to justify adding more infrastructure to
> > support a single callsite which has a simple alternative.  So if you could
> > please add the separate counter?
> 
> It's pretty *small* infrastructure, and it gives me something to whine at
> people about when they use atomic_read on something that isn't an atomic.

Agreed, but I don't mind adding a separate counter.  However...

> If we are going to get rid of sem_getcount, could we rename the 'count'
> variables, at least on i386 and ppc to make it clear that you're not
> supposed to do this ... maybe to 'count_$ARCH'?

I'm working on a patch to do just that.  It fails when building XFS:

fs/xfs/xfs_inode_item.c: In function `xfs_inode_item_pushbuf':
fs/xfs/xfs_inode_item.c:803: error: structure has no member named `count'
fs/xfs/xfs_inode_item.c:825: error: structure has no member named `count'

fs/xfs/linux-2.6/sema.h:
#define valusema(sp)                    (atomic_read(&(sp)->count))

It seems getting the value of a semaphore is more common than it appears
at first glance.  I don't see how this code could possibly work on
parisc.  Therefore I propose:

1. Adding sem_getcount() everywhere, as in my original patch.
2. Renaming count to count_$ARCH as willy suggested.
3. Anyone who abuses semaphores will now break.  Fix them to use
   sem_getcount().

I'll work on that over the weekend unless anyone has any better ideas.

Jody


> 
> -- 
> "Next the statesmen will invent cheap lies, putting the blame upon 
> the nation that is attacked, and every man will be glad of those
> conscience-soothing falsities, and will diligently study them, and refuse
> to examine any refutations of them; and thus he will by and by convince 
> himself that the war is just, and will thank God for the better sleep 
> he enjoys after this process of grotesque self-deception." -- Mark Twain

-- 

  reply	other threads:[~2005-03-11 17:07 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-03-11  0:06 Jody McIntyre
2005-03-11  0:08 ` [PATCH, RFC 2/3] Use sem_getcount in ieee1394 Jody McIntyre
2005-03-11  0:10 ` [PATCH, RFC 3/3] Use sem_getcount in xfs Jody McIntyre
2005-03-11  4:55 ` [PATCH, RFC 1/3] Add sem_getcount() to arches that lack it Andrew Morton
2005-03-11  5:10   ` Roland Dreier
2005-03-11  5:18     ` Nathan Scott
2005-03-11  5:31   ` Jody McIntyre
2005-03-11  5:56     ` Andrew Morton
2005-03-11 12:27       ` Matthew Wilcox
2005-03-11 17:04         ` Jody McIntyre [this message]
2005-03-16 19:27           ` [PATCH, RFC 1/4] Rename semaphore count variable to be arch specific Jody McIntyre
2005-03-16 19:28             ` [PATCH, RFC 2/4] Add sem_getcount on arches that lack it Jody McIntyre
2005-03-16 19:28             ` [PATCH, RFC 3/4] Use sem_getcount in XFS Jody McIntyre
2005-03-16 19:31             ` [PATCH, RFC 4/4] Use sem_getcount in ieee1394 Jody McIntyre

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=20050311170449.GS1111@conscoop.ottawa.on.ca \
    --to=scjody@modernduck.com \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=matthew@wil.cx \
    --cc=nathans@sgi.com \
    --cc=willy@debian.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

Powered by JetHome