diff options
author | Alexey Dobriyan <adobriyan@gmail.com> | 2008-07-25 22:45:34 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-07-26 15:00:07 -0400 |
commit | 51cc50685a4275c6a02653670af9f108a64e01cf (patch) | |
tree | 819d47bd2b0c8a9d1835d863853804b0a0242b97 /arch/powerpc/mm | |
parent | d91958815d214ea365b98cbff6215383897edcb6 (diff) |
SL*B: drop kmem cache argument from constructor
Kmem cache passed to constructor is only needed for constructors that are
themselves multiplexeres. Nobody uses this "feature", nor does anybody uses
passed kmem cache in non-trivial way, so pass only pointer to object.
Non-trivial places are:
arch/powerpc/mm/init_64.c
arch/powerpc/mm/hugetlbpage.c
This is flag day, yes.
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Acked-by: Pekka Enberg <penberg@cs.helsinki.fi>
Acked-by: Christoph Lameter <cl@linux-foundation.org>
Cc: Jon Tollefson <kniht@linux.vnet.ibm.com>
Cc: Nick Piggin <nickpiggin@yahoo.com.au>
Cc: Matt Mackall <mpm@selenic.com>
[akpm@linux-foundation.org: fix arch/powerpc/mm/hugetlbpage.c]
[akpm@linux-foundation.org: fix mm/slab.c]
[akpm@linux-foundation.org: fix ubifs]
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch/powerpc/mm')
-rw-r--r-- | arch/powerpc/mm/hugetlbpage.c | 9 | ||||
-rw-r--r-- | arch/powerpc/mm/init_64.c | 24 |
2 files changed, 11 insertions, 22 deletions
diff --git a/arch/powerpc/mm/hugetlbpage.c b/arch/powerpc/mm/hugetlbpage.c index fb42c4dd3217..ed0aab0208a6 100644 --- a/arch/powerpc/mm/hugetlbpage.c +++ b/arch/powerpc/mm/hugetlbpage.c | |||
@@ -113,7 +113,7 @@ static inline pte_t *hugepte_offset(hugepd_t *hpdp, unsigned long addr, | |||
113 | static int __hugepte_alloc(struct mm_struct *mm, hugepd_t *hpdp, | 113 | static int __hugepte_alloc(struct mm_struct *mm, hugepd_t *hpdp, |
114 | unsigned long address, unsigned int psize) | 114 | unsigned long address, unsigned int psize) |
115 | { | 115 | { |
116 | pte_t *new = kmem_cache_alloc(huge_pgtable_cache(psize), | 116 | pte_t *new = kmem_cache_zalloc(huge_pgtable_cache(psize), |
117 | GFP_KERNEL|__GFP_REPEAT); | 117 | GFP_KERNEL|__GFP_REPEAT); |
118 | 118 | ||
119 | if (! new) | 119 | if (! new) |
@@ -730,11 +730,6 @@ static int __init hugepage_setup_sz(char *str) | |||
730 | } | 730 | } |
731 | __setup("hugepagesz=", hugepage_setup_sz); | 731 | __setup("hugepagesz=", hugepage_setup_sz); |
732 | 732 | ||
733 | static void zero_ctor(struct kmem_cache *cache, void *addr) | ||
734 | { | ||
735 | memset(addr, 0, kmem_cache_size(cache)); | ||
736 | } | ||
737 | |||
738 | static int __init hugetlbpage_init(void) | 733 | static int __init hugetlbpage_init(void) |
739 | { | 734 | { |
740 | unsigned int psize; | 735 | unsigned int psize; |
@@ -756,7 +751,7 @@ static int __init hugetlbpage_init(void) | |||
756 | HUGEPTE_TABLE_SIZE(psize), | 751 | HUGEPTE_TABLE_SIZE(psize), |
757 | HUGEPTE_TABLE_SIZE(psize), | 752 | HUGEPTE_TABLE_SIZE(psize), |
758 | 0, | 753 | 0, |
759 | zero_ctor); | 754 | NULL); |
760 | if (!huge_pgtable_cache(psize)) | 755 | if (!huge_pgtable_cache(psize)) |
761 | panic("hugetlbpage_init(): could not create %s"\ | 756 | panic("hugetlbpage_init(): could not create %s"\ |
762 | "\n", HUGEPTE_CACHE_NAME(psize)); | 757 | "\n", HUGEPTE_CACHE_NAME(psize)); |
diff --git a/arch/powerpc/mm/init_64.c b/arch/powerpc/mm/init_64.c index a41bc5aa2043..4f7df85129d8 100644 --- a/arch/powerpc/mm/init_64.c +++ b/arch/powerpc/mm/init_64.c | |||
@@ -136,9 +136,14 @@ static int __init setup_kcore(void) | |||
136 | module_init(setup_kcore); | 136 | module_init(setup_kcore); |
137 | #endif | 137 | #endif |
138 | 138 | ||
139 | static void zero_ctor(struct kmem_cache *cache, void *addr) | 139 | static void pgd_ctor(void *addr) |
140 | { | 140 | { |
141 | memset(addr, 0, kmem_cache_size(cache)); | 141 | memset(addr, 0, PGD_TABLE_SIZE); |
142 | } | ||
143 | |||
144 | static void pmd_ctor(void *addr) | ||
145 | { | ||
146 | memset(addr, 0, PMD_TABLE_SIZE); | ||
142 | } | 147 | } |
143 | 148 | ||
144 | static const unsigned int pgtable_cache_size[2] = { | 149 | static const unsigned int pgtable_cache_size[2] = { |
@@ -163,19 +168,8 @@ struct kmem_cache *pgtable_cache[ARRAY_SIZE(pgtable_cache_size)]; | |||
163 | 168 | ||
164 | void pgtable_cache_init(void) | 169 | void pgtable_cache_init(void) |
165 | { | 170 | { |
166 | int i; | 171 | pgtable_cache[0] = kmem_cache_create(pgtable_cache_name[0], PGD_TABLE_SIZE, PGD_TABLE_SIZE, SLAB_PANIC, pgd_ctor); |
167 | 172 | pgtable_cache[1] = kmem_cache_create(pgtable_cache_name[1], PMD_TABLE_SIZE, PMD_TABLE_SIZE, SLAB_PANIC, pmd_ctor); | |
168 | for (i = 0; i < ARRAY_SIZE(pgtable_cache_size); i++) { | ||
169 | int size = pgtable_cache_size[i]; | ||
170 | const char *name = pgtable_cache_name[i]; | ||
171 | |||
172 | pr_debug("Allocating page table cache %s (#%d) " | ||
173 | "for size: %08x...\n", name, i, size); | ||
174 | pgtable_cache[i] = kmem_cache_create(name, | ||
175 | size, size, | ||
176 | SLAB_PANIC, | ||
177 | zero_ctor); | ||
178 | } | ||
179 | } | 173 | } |
180 | 174 | ||
181 | #ifdef CONFIG_SPARSEMEM_VMEMMAP | 175 | #ifdef CONFIG_SPARSEMEM_VMEMMAP |