summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Morton <akpm@osdl.org>2004-05-19 02:35:39 -0700
committerLinus Torvalds <torvalds@ppc970.osdl.org>2004-05-19 02:35:39 -0700
commita3e754c2e0c086dfa9e64b672d8a529ef5dfd8c2 (patch)
treeea55c70cf5cef37ad467cecfc76297b54cf9ae2d
parent897d49be87feb06747a3538e7fbf16cdcd349b75 (diff)
[PATCH] slab: allow arch override for kmem_bufctl_t
From: Manfred Spraul <manfred@colorfullife.com> The slab allocator keeps track of the free objects in a slab with a linked list of integers (typedef'ed to kmem_bufctl_t). Right now unsigned int is used for kmem_bufctl_t, i.e. 4 bytes per-object overhead. The attached patch implements a per-arch definition of for this type: Theoretically, unsigned short is sufficient for kmem_bufctl_t and this would reduce the per-object overhead to 2 bytes. But some archs cannot operate on 16-bit values efficiently, thus it's not possible to switch everyone to ushort. The chosen types are a result of dicussions with the various arch maintainers.
-rw-r--r--include/asm-alpha/types.h2
-rw-r--r--include/asm-arm/types.h2
-rw-r--r--include/asm-arm26/types.h2
-rw-r--r--include/asm-cris/types.h2
-rw-r--r--include/asm-h8300/types.h2
-rw-r--r--include/asm-i386/types.h2
-rw-r--r--include/asm-ia64/types.h2
-rw-r--r--include/asm-m68k/types.h2
-rw-r--r--include/asm-mips/types.h2
-rw-r--r--include/asm-parisc/types.h2
-rw-r--r--include/asm-ppc/types.h2
-rw-r--r--include/asm-ppc64/types.h2
-rw-r--r--include/asm-s390/types.h2
-rw-r--r--include/asm-sh/types.h2
-rw-r--r--include/asm-sparc/types.h2
-rw-r--r--include/asm-sparc64/types.h2
-rw-r--r--include/asm-v850/types.h2
-rw-r--r--include/asm-x86_64/types.h2
-rw-r--r--mm/slab.c7
19 files changed, 39 insertions, 4 deletions
diff --git a/include/asm-alpha/types.h b/include/asm-alpha/types.h
index f5716139ec89..43264d219246 100644
--- a/include/asm-alpha/types.h
+++ b/include/asm-alpha/types.h
@@ -56,6 +56,8 @@ typedef unsigned long u64;
typedef u64 dma_addr_t;
typedef u64 dma64_addr_t;
+typedef unsigned short kmem_bufctl_t;
+
#endif /* __ASSEMBLY__ */
#endif /* __KERNEL__ */
#endif /* _ALPHA_TYPES_H */
diff --git a/include/asm-arm/types.h b/include/asm-arm/types.h
index 22992ee0627a..f4c92e4c8c02 100644
--- a/include/asm-arm/types.h
+++ b/include/asm-arm/types.h
@@ -52,6 +52,8 @@ typedef unsigned long long u64;
typedef u32 dma_addr_t;
typedef u32 dma64_addr_t;
+typedef unsigned int kmem_bufctl_t;
+
#endif /* __ASSEMBLY__ */
#endif /* __KERNEL__ */
diff --git a/include/asm-arm26/types.h b/include/asm-arm26/types.h
index 81bd357ada02..56cbe573a234 100644
--- a/include/asm-arm26/types.h
+++ b/include/asm-arm26/types.h
@@ -52,6 +52,8 @@ typedef unsigned long long u64;
typedef u32 dma_addr_t;
typedef u32 dma64_addr_t;
+typedef unsigned int kmem_bufctl_t;
+
#endif /* __ASSEMBLY__ */
#endif /* __KERNEL__ */
diff --git a/include/asm-cris/types.h b/include/asm-cris/types.h
index 25425c09ddbc..bd329ffebf76 100644
--- a/include/asm-cris/types.h
+++ b/include/asm-cris/types.h
@@ -51,6 +51,8 @@ typedef unsigned long long u64;
typedef u32 dma_addr_t;
+typedef unsigned int kmem_bufctl_t;
+
#endif /* __ASSEMBLY__ */
#endif /* __KERNEL__ */
diff --git a/include/asm-h8300/types.h b/include/asm-h8300/types.h
index bf91e0d4dde7..21f4fc07ac0e 100644
--- a/include/asm-h8300/types.h
+++ b/include/asm-h8300/types.h
@@ -58,6 +58,8 @@ typedef u32 dma_addr_t;
#define HAVE_SECTOR_T
typedef u64 sector_t;
+typedef unsigned int kmem_bufctl_t;
+
#endif /* __KERNEL__ */
#endif /* __ASSEMBLY__ */
diff --git a/include/asm-i386/types.h b/include/asm-i386/types.h
index ced00fe8fe61..901b77c42b8a 100644
--- a/include/asm-i386/types.h
+++ b/include/asm-i386/types.h
@@ -63,6 +63,8 @@ typedef u64 sector_t;
#define HAVE_SECTOR_T
#endif
+typedef unsigned short kmem_bufctl_t;
+
#endif /* __ASSEMBLY__ */
#endif /* __KERNEL__ */
diff --git a/include/asm-ia64/types.h b/include/asm-ia64/types.h
index 902850d12424..a677565aa954 100644
--- a/include/asm-ia64/types.h
+++ b/include/asm-ia64/types.h
@@ -67,6 +67,8 @@ typedef __u64 u64;
typedef u64 dma_addr_t;
+typedef unsigned short kmem_bufctl_t;
+
# endif /* __KERNEL__ */
#endif /* !__ASSEMBLY__ */
diff --git a/include/asm-m68k/types.h b/include/asm-m68k/types.h
index b5a1febc97d4..f391cbe39b96 100644
--- a/include/asm-m68k/types.h
+++ b/include/asm-m68k/types.h
@@ -60,6 +60,8 @@ typedef unsigned long long u64;
typedef u32 dma_addr_t;
typedef u32 dma64_addr_t;
+typedef unsigned short kmem_bufctl_t;
+
#endif /* __ASSEMBLY__ */
#endif /* __KERNEL__ */
diff --git a/include/asm-mips/types.h b/include/asm-mips/types.h
index b949ab33e8e2..d2f0c76b00a9 100644
--- a/include/asm-mips/types.h
+++ b/include/asm-mips/types.h
@@ -99,6 +99,8 @@ typedef u64 sector_t;
#define HAVE_SECTOR_T
#endif
+typedef unsigned short kmem_bufctl_t;
+
#endif /* __ASSEMBLY__ */
#endif /* __KERNEL__ */
diff --git a/include/asm-parisc/types.h b/include/asm-parisc/types.h
index d21b9d0d63ea..8fe7a44ea205 100644
--- a/include/asm-parisc/types.h
+++ b/include/asm-parisc/types.h
@@ -56,6 +56,8 @@ typedef unsigned long long u64;
typedef u32 dma_addr_t;
typedef u64 dma64_addr_t;
+typedef unsigned int kmem_bufctl_t;
+
#endif /* __ASSEMBLY__ */
#endif /* __KERNEL__ */
diff --git a/include/asm-ppc/types.h b/include/asm-ppc/types.h
index 77dc24d7d2ad..a787bc032587 100644
--- a/include/asm-ppc/types.h
+++ b/include/asm-ppc/types.h
@@ -62,6 +62,8 @@ typedef u64 sector_t;
#define HAVE_SECTOR_T
#endif
+typedef unsigned int kmem_bufctl_t;
+
#endif /* __ASSEMBLY__ */
#endif /* __KERNEL__ */
diff --git a/include/asm-ppc64/types.h b/include/asm-ppc64/types.h
index 0fb0412a5394..ac7fe0b03766 100644
--- a/include/asm-ppc64/types.h
+++ b/include/asm-ppc64/types.h
@@ -73,6 +73,8 @@ typedef struct {
} func_descr_t;
#endif /* __ASSEMBLY__ */
+typedef unsigned int kmem_bufctl_t;
+
#endif /* __KERNEL__ */
#endif /* _PPC64_TYPES_H */
diff --git a/include/asm-s390/types.h b/include/asm-s390/types.h
index d0be3e477013..ca4afdd6e747 100644
--- a/include/asm-s390/types.h
+++ b/include/asm-s390/types.h
@@ -93,6 +93,8 @@ typedef u64 sector_t;
#define HAVE_SECTOR_T
#endif
+typedef unsigned int kmem_bufctl_t;
+
#endif /* ! __s390x__ */
#endif /* __ASSEMBLY__ */
#endif /* __KERNEL__ */
diff --git a/include/asm-sh/types.h b/include/asm-sh/types.h
index cb7e183a0a6b..c4dc126c5621 100644
--- a/include/asm-sh/types.h
+++ b/include/asm-sh/types.h
@@ -58,6 +58,8 @@ typedef u64 sector_t;
#define HAVE_SECTOR_T
#endif
+typedef unsigned int kmem_bufctl_t;
+
#endif /* __ASSEMBLY__ */
#endif /* __KERNEL__ */
diff --git a/include/asm-sparc/types.h b/include/asm-sparc/types.h
index 42fc6ed98156..9eabf6e61ccc 100644
--- a/include/asm-sparc/types.h
+++ b/include/asm-sparc/types.h
@@ -54,6 +54,8 @@ typedef unsigned long long u64;
typedef u32 dma_addr_t;
typedef u32 dma64_addr_t;
+typedef unsigned short kmem_bufctl_t;
+
#endif /* __ASSEMBLY__ */
#endif /* __KERNEL__ */
diff --git a/include/asm-sparc64/types.h b/include/asm-sparc64/types.h
index d0ee7f105838..6248ed1a9a7a 100644
--- a/include/asm-sparc64/types.h
+++ b/include/asm-sparc64/types.h
@@ -56,6 +56,8 @@ typedef unsigned long u64;
typedef u32 dma_addr_t;
typedef u64 dma64_addr_t;
+typedef unsigned short kmem_bufctl_t;
+
#endif /* __ASSEMBLY__ */
#endif /* __KERNEL__ */
diff --git a/include/asm-v850/types.h b/include/asm-v850/types.h
index dcef57196875..e7cfe5b33a10 100644
--- a/include/asm-v850/types.h
+++ b/include/asm-v850/types.h
@@ -59,6 +59,8 @@ typedef unsigned long long u64;
typedef u32 dma_addr_t;
+typedef unsigned int kmem_bufctl_t;
+
#endif /* !__ASSEMBLY__ */
#endif /* __KERNEL__ */
diff --git a/include/asm-x86_64/types.h b/include/asm-x86_64/types.h
index c86c2e6793e2..32bd1426b523 100644
--- a/include/asm-x86_64/types.h
+++ b/include/asm-x86_64/types.h
@@ -51,6 +51,8 @@ typedef u64 dma_addr_t;
typedef u64 sector_t;
#define HAVE_SECTOR_T
+typedef unsigned short kmem_bufctl_t;
+
#endif /* __ASSEMBLY__ */
#endif /* __KERNEL__ */
diff --git a/mm/slab.c b/mm/slab.c
index 6b3cedfc6b2d..7754fe29d90e 100644
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -161,10 +161,9 @@
* is less than 512 (PAGE_SIZE<<3), but greater than 256.
*/
-#define BUFCTL_END 0xffffFFFF
-#define BUFCTL_FREE 0xffffFFFE
-#define SLAB_LIMIT 0xffffFFFD
-typedef unsigned int kmem_bufctl_t;
+#define BUFCTL_END (((kmem_bufctl_t)(~0U))-0)
+#define BUFCTL_FREE (((kmem_bufctl_t)(~0U))-1)
+#define SLAB_LIMIT (((kmem_bufctl_t)(~0U))-2)
/* Max number of objs-per-slab for caches which use off-slab slabs.
* Needed to avoid a possible looping condition in cache_grow().