Linux PARISC architecture development
 help / color / mirror / Atom feed
From: Grant Grundler <grundler@parisc-linux.org>
To: parisc-linux@parisc-linux.org
Subject: [parisc-linux] ATOMIC_HASH brainfart
Date: Sat, 3 Apr 2004 23:56:04 -0700	[thread overview]
Message-ID: <20040404065604.GA2335@colo.lackof.org> (raw)

Hi all,
Seems like someone was confused when they hacked ATOMIC_HASH macro.
Cacheline is 64 bytes not 256...but I've been told several times gcc
is smart enough to convert "foo/64" to "foo>>6"...then just use
the L1_CACHE_BYTES definition to indicate intent?

I haven't verified everything builds and works right
but it looks "obviously correct" to me. Comments?

I'm still looking at getting SMP to boot.

grant


Index: include/asm/atomic.h
===================================================================
RCS file: /var/cvs/linux-2.6/include/asm-parisc/atomic.h,v
retrieving revision 1.6
diff -u -p -r1.6 atomic.h
--- a/include/asm/atomic.h	25 Mar 2004 06:19:07 -0000	1.6
+++ b/include/asm/atomic.h	4 Apr 2004 06:48:20 -0000
@@ -19,10 +19,10 @@ typedef spinlock_t atomic_lock_t;
 
 /* Use an array of spinlocks for our atomic_ts.
  * Hash function to index into a different SPINLOCK.
- * Since "a" is usually an address, ">>8" makes one spinlock per 64-bytes.
+ * Since "a" is usually an address, use one spinlock per cacheline.
  */
 #  define ATOMIC_HASH_SIZE 4
-#  define ATOMIC_HASH(a) (&__atomic_hash[(((unsigned long) a)>>8)&(ATOMIC_HASH_SIZE-1)])
+#  define ATOMIC_HASH(a) (&__atomic_hash[(((unsigned long) a)/L1_CACHE_BYTES)&(ATOMIC_HASH_SIZE-1)])
 
 extern atomic_lock_t __atomic_hash[ATOMIC_HASH_SIZE] __lock_aligned;
 

             reply	other threads:[~2004-04-04  6:56 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-04-04  6:56 Grant Grundler [this message]
2004-04-05  0:08 ` [parisc-linux] ATOMIC_HASH brainfart Alan Cox
2004-04-05  0:20   ` Randolph Chung

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=20040404065604.GA2335@colo.lackof.org \
    --to=grundler@parisc-linux.org \
    --cc=parisc-linux@parisc-linux.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