mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Stefan Richter <stefanr@s5r6.in-berlin.de>
To: linux1394-devel@lists.sourceforge.net
Cc: linux-kernel@vger.kernel.org
Subject: [RFC PATCH 2.6.17-mm1 2/3] ieee1394: coarser locking for tlabel allocation
Date: Sat, 24 Jun 2006 11:33:49 +0200 (CEST)	[thread overview]
Message-ID: <tkrat.e74b06c4105348f6@s5r6.in-berlin.de> (raw)
In-Reply-To: <tkrat.9c73406a85ae9ce4@s5r6.in-berlin.de>

Full parallelism in getting and freeing transaction labels of different
nodes is not really required.  Therefore reduce the number of locks for
access to tlabel pools from 63 locks per host to 1 global lock.

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
---
 drivers/ieee1394/ieee1394_transactions.c |   10 ++++++----
 drivers/ieee1394/ieee1394_types.h        |    2 --
 2 files changed, 6 insertions(+), 6 deletions(-)

Index: linux/drivers/ieee1394/ieee1394_types.h
===================================================================
--- linux.orig/drivers/ieee1394/ieee1394_types.h	2006-06-24 09:53:24.000000000 +0200
+++ linux/drivers/ieee1394/ieee1394_types.h	2006-06-24 10:02:15.000000000 +0200
@@ -16,7 +16,6 @@
 /* Transaction Label handling */
 struct hpsb_tlabel_pool {
 	DECLARE_BITMAP(pool, 64);
-	spinlock_t lock;
 #ifdef __BIG_ENDIAN_BITFIELD
 	u32 allocations	:26 __attribute__((packed));
 	u32 next	:6  __attribute__((packed));
@@ -30,7 +29,6 @@ struct hpsb_tlabel_pool {
 #define HPSB_TPOOL_INIT(_tp)			\
 do {						\
 	bitmap_zero((_tp)->pool, 64);		\
-	spin_lock_init(&(_tp)->lock);		\
 	(_tp)->next = 0;			\
 	(_tp)->allocations = 0;			\
 	sema_init(&(_tp)->count, 63);		\
Index: linux/drivers/ieee1394/ieee1394_transactions.c
===================================================================
--- linux.orig/drivers/ieee1394/ieee1394_transactions.c	2006-06-24 09:24:00.000000000 +0200
+++ linux/drivers/ieee1394/ieee1394_transactions.c	2006-06-24 10:08:35.000000000 +0200
@@ -31,6 +31,8 @@
         packet->header[1] = (packet->host->node_id << 16) | (addr >> 32); \
         packet->header[2] = addr & 0xffffffff
 
+static spinlock_t hpsb_tlabel_lock = SPIN_LOCK_UNLOCKED;
+
 static void fill_async_readquad(struct hpsb_packet *packet, u64 addr)
 {
 	PREP_ASYNC_HEAD_ADDRESS(TCODE_READQ);
@@ -149,7 +151,7 @@ int hpsb_get_tlabel(struct hpsb_packet *
 		down(&tp->count);
 	}
 
-	spin_lock_irqsave(&tp->lock, flags);
+	spin_lock_irqsave(&hpsb_tlabel_lock, flags);
 
 	tlabel = find_next_zero_bit(tp->pool, 64, tp->next);
 	if (tlabel > 63)
@@ -160,7 +162,7 @@ int hpsb_get_tlabel(struct hpsb_packet *
 	BUG_ON(test_and_set_bit(tlabel, tp->pool));
 	tp->allocations++;
 
-	spin_unlock_irqrestore(&tp->lock, flags);
+	spin_unlock_irqrestore(&hpsb_tlabel_lock, flags);
 	packet->tlabel = tlabel;
 	return 0;
 }
@@ -188,9 +190,9 @@ void hpsb_free_tlabel(struct hpsb_packet
 
 	BUG_ON(tlabel > 63 || tlabel < 0);
 
-	spin_lock_irqsave(&tp->lock, flags);
+	spin_lock_irqsave(&hpsb_tlabel_lock, flags);
 	BUG_ON(!test_and_clear_bit(tlabel, tp->pool));
-	spin_unlock_irqrestore(&tp->lock, flags);
+	spin_unlock_irqrestore(&hpsb_tlabel_lock, flags);
 
 	up(&tp->count);
 }



  reply	other threads:[~2006-06-24  9:35 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <449BEBFB.60302@s5r6.in-berlin.de>
     [not found] ` <200606230904.k5N94Al3005245@shell0.pdx.osdl.net>
     [not found]   ` <30866.1151072338@warthog.cambridge.redhat.com>
     [not found]     ` <tkrat.df6845846c72176e@s5r6.in-berlin.de>
2006-06-24  9:32       ` [RFC PATCH 2.6.17-mm1 1/3] ieee1394: reduce size of hpsb_host by 252 bytes Stefan Richter
2006-06-24  9:33         ` Stefan Richter [this message]
2006-06-24  9:35           ` [RFC PATCH 2.6.17-mm1 3/3] ieee1394: nodemgr: read tlabel attributes atomically Stefan Richter
2006-06-24 17:32             ` [RFC PATCH 2.6.17-mm1 4/3] ieee1394: convert ieee1394_transactions from semaphores to waitqueue Stefan Richter
2006-06-24 17:45               ` Stefan Richter
2006-06-24 18:12                 ` Arjan van de Ven
2006-06-24 20:28                   ` Stefan Richter
2006-06-24 20:56                     ` Stefan Richter
2006-06-25 19:37                   ` [RFC PATCH 2.6.17-mm1 5/3] ieee1394: raw1394: remove redundant counting semaphore Stefan Richter
2006-06-25 19:54                     ` Stefan Richter
2006-06-25 17:27               ` [RFC PATCH 2.6.17-mm1 4/3] ieee1394: convert ieee1394_transactions from semaphores to waitqueue Stefan Richter

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=tkrat.e74b06c4105348f6@s5r6.in-berlin.de \
    --to=stefanr@s5r6.in-berlin.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux1394-devel@lists.sourceforge.net \
    /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

all inboxes | Powered by JetHome®