public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Frank Rowand <frowand@mvista.com>
To: Ingo Molnar <mingo@elte.hu>
Cc: linux-kernel@vger.kernel.org, frowand@mvista.com
Subject: Re: [PATCH 0/5] ppc RT: Realtime preempt support for PPC
Date: Fri, 01 Apr 2005 15:55:11 -0800	[thread overview]
Message-ID: <424DDF5F.9080909@mvista.com> (raw)
In-Reply-To: <20050331091614.GB22397@elte.hu>

Ingo Molnar wrote:
> * Frank Rowand <frowand@mvista.com> wrote:
> 
> 
>>< more stuff deleted >
>>
>>I'm working on the architecture support for realtime on PPC64 now. If 
>>the lock field of struct raw_rwlock_t is a long instead of int then 
>>/proc/meminfo shows MemFree decreasing from 485608 kB to 485352 kB.
>>
>>Do you have a preference for lock to be long instead of int?
>>
>>Do you know if any of the other 64 bit architectures would have an 
>>issue with int?
> 
> 
> that would be nice to know. I have no preference, other than if possible 
> it should be unified, no #ifdefs or other conditionals.
> 
> 	Ingo

I looked at all the architectures and found that the disparity of the
type of the "lock" field in struct rwlock_t is even larger than I had
indicated in my earlier email.  I am attaching a proof of concept patch
to handle this.  If this looks like a good method to you then I will
create a real patch against your current patch, and include i386,
mips, x86_64, and ppc.


Index: linux-2.6.10/include/linux/rt_lock.h
===================================================================
--- linux-2.6.10.orig/include/linux/rt_lock.h
+++ linux-2.6.10/include/linux/rt_lock.h
@@ -37,8 +37,9 @@ typedef struct {
   * but only one writer.
   */
  #ifdef CONFIG_SMP
+#include <asm/raw_spinlock.h>
  typedef struct {
-       volatile unsigned long lock;
+       ARCH_RAW_RWLOCK_LOCK
  # ifdef CONFIG_DEBUG_SPINLOCK
         unsigned magic;
  # endif
Index: linux-2.6.10/include/asm-ppc/raw_spinlock.h
===================================================================
--- /dev/null
+++ linux-2.6.10/include/asm-ppc/raw_spinlock.h
@@ -0,0 +1,6 @@
+#ifndef __ASM_RAW_SPINLOCK_H
+#define __ASM_RAW_SPINLOCK_H
+
+#define ARCH_RAW_RWLOCK_LOCK volatile signed int lock;
+
+#endif /* __ASM_RAW_SPINLOCK_H */
Index: linux-2.6.10/include/asm-i386/raw_spinlock.h
===================================================================
--- /dev/null
+++ linux-2.6.10/include/asm-i386/raw_spinlock.h
@@ -0,0 +1,6 @@
+#ifndef __ASM_RAW_SPINLOCK_H
+#define __ASM_RAW_SPINLOCK_H
+
+#define ARCH_RAW_RWLOCK_LOCK volatile unsigned int lock;
+
+#endif /* __ASM_RAW_SPINLOCK_H */




For the curious, the implementations of the "lock" field are listed
below:


rwlock_t lock implemented as a spinlock field and a counter field

    include/asm-parisc/spinlock.h
    include/asm-sh/spinlock.h

rwlock_t lock implemented as a 31 bit counter field and a 1 bit write lock field
    include/asm-ia64/spinlock.h

rwlock_t lock implemented as a 1 bit write lock field and a 31 bit counter field
    include/asm-alpha/spinlock.h

rwlock_t lock implemented as an unsigned int field

    include/asm-arm/spinlock.h
    include/asm-i386/spinlock.h
    include/asm-mips/spinlock.h
    include/asm-x86_64/spinlock.h
    include/asm-sparc/spinlock.h
    include/asm-sparc64/spinlock.h #ifdef CONFIG_DEBUG_SPINLOCK

rwlock_t lock implemented as a signed int field

    include/asm-m32r/spinlock.h
    include/asm-ppc64/spinlock.h
    include/asm-ppc/spinlock.h

rwlock_t lock implemented as an unsigned long field

    include/asm-s390/spinlock.h

rwlock_t lock implemented as an unsigned int (_not_ in a structure)

    include/asm-sparc64/spinlock.h #ifdef CONFIG_DEBUG_SPINLOCK

SMP rwlock_t not supported (no SMP support)

    include/asm-arm26/spinlock.h
    include/asm-frv/spinlock.h
    include/asm-h8300/spinlock.h
    include/asm-m68knommu/spinlock.h
    include/asm-m68k/spinlock.h
    include/asm-sh64/spinlock.h


-Frank
-- 
Frank Rowand <frank_rowand@mvista.com>
MontaVista Software, Inc


  reply	other threads:[~2005-04-02  0:24 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-03-07 21:48 [PATCH 0/5] ppc RT: Realtime preempt support for PPC Frank Rowand
2005-03-16 10:09 ` Ingo Molnar
2005-03-16 15:30   ` K.R. Foley
2005-03-17  8:38     ` Ingo Molnar
2005-03-22  0:38   ` Frank Rowand
2005-03-31  1:36     ` Frank Rowand
2005-03-31  9:16       ` Ingo Molnar
2005-04-01 23:55         ` Frank Rowand [this message]
2005-04-05  5:39           ` Ingo Molnar

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=424DDF5F.9080909@mvista.com \
    --to=frowand@mvista.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    /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