mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jody McIntyre <scjody@modernduck.com>
To: Andrew Morton <akpm@osdl.org>
Cc: linux-kernel@vger.kernel.org, willy@debian.org,
	Nathan Scott <nathans@sgi.com>
Subject: Re: [PATCH, RFC 1/3] Add sem_getcount() to arches that lack it
Date: Fri, 11 Mar 2005 00:31:44 -0500	[thread overview]
Message-ID: <20050311053144.GP1111@conscoop.ottawa.on.ca> (raw)
In-Reply-To: <20050310205503.6151ab83.akpm@osdl.org>

On Thu, Mar 10, 2005 at 08:55:03PM -0800, Andrew Morton wrote:
> Jody McIntyre <scjody@modernduck.com> wrote:
> >
> > parisc and frv define sem_getcount() in semaphore.h, which returns the
> >  current semaphore value.  This is cleaner than doing
> >  atomic_read(&semaphore.count), currently done in
> >  drivers/ieee1394/nodemgr.c and fs/xfs/linux-2.6/xfs_buf.c, and will work
> >  on all architectures if sem_getcount() is added.
> 
> That's a fairly bizarre thing to want to do.  Would it be hard to modify
> xfs and 1394 to stop wanting to read a semaphore's up() count?

The count is the number of free transaction labels (1394 async is
transaction-based) and is initialized to 64.  When a new transaction label
is needed, the requestor does a down(), then locks the tlabel variables
and allocates a new one.  When a transaction label is freed, an up()
occurs.  The semaphore's up() count is therefore the number of free
tlabels, and the number of outstanding transactions is (64 - count).  I
can imagine situations in which this would be a useful statistic, but
I'm not sure any of them actually exist.

I haven't investigated xfs, but modifying 1394 would be fairly easy.  I
could add a second variable that tracks the up() count, or just drop the
sysfs attribute that reports the number.  The first option seems a bit
wasteful, but only slightly.  I thought this patch was worthwhile based
on xfs wanting to do this and 3 arches already having (unused)
implementations of sem_getcount/sema_count.

If this patch isn't accepted, we should get rid of the xfs and 1394
hacks and delete sem_getcount (parisc, frv) and sema_count (arm) as they
are unused.

Jody

> 
> (Why do they want to do this anyway?)

-- 

  parent reply	other threads:[~2005-03-11  5:39 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 [this message]
2005-03-11  5:56     ` Andrew Morton
2005-03-11 12:27       ` Matthew Wilcox
2005-03-11 17:04         ` Jody McIntyre
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=20050311053144.GP1111@conscoop.ottawa.on.ca \
    --to=scjody@modernduck.com \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --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