Re: [PATCH 0/5] ppc RT: Realtime preempt support for PPC

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Ingo Molnar wrote:
* Frank Rowand <[email protected]> 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 <[email protected]>
MontaVista Software, Inc

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux