aboutsummaryrefslogtreecommitdiffstats
path: root/mm
diff options
context:
space:
mode:
Diffstat (limited to 'mm')
-rw-r--r--mm/slob.c15
1 files changed, 3 insertions, 12 deletions
diff --git a/mm/slob.c b/mm/slob.c
index c9401a7eaa5f..c6933bc19bcd 100644
--- a/mm/slob.c
+++ b/mm/slob.c
@@ -150,15 +150,6 @@ static void slob_free(void *block, int size)
150 spin_unlock_irqrestore(&slob_lock, flags); 150 spin_unlock_irqrestore(&slob_lock, flags);
151} 151}
152 152
153static int FASTCALL(find_order(int size));
154static int fastcall find_order(int size)
155{
156 int order = 0;
157 for ( ; size > 4096 ; size >>=1)
158 order++;
159 return order;
160}
161
162void *__kmalloc(size_t size, gfp_t gfp) 153void *__kmalloc(size_t size, gfp_t gfp)
163{ 154{
164 slob_t *m; 155 slob_t *m;
@@ -174,7 +165,7 @@ void *__kmalloc(size_t size, gfp_t gfp)
174 if (!bb) 165 if (!bb)
175 return 0; 166 return 0;
176 167
177 bb->order = find_order(size); 168 bb->order = get_order(size);
178 bb->pages = (void *)__get_free_pages(gfp, bb->order); 169 bb->pages = (void *)__get_free_pages(gfp, bb->order);
179 170
180 if (bb->pages) { 171 if (bb->pages) {
@@ -318,7 +309,7 @@ void *kmem_cache_alloc(struct kmem_cache *c, gfp_t flags)
318 if (c->size < PAGE_SIZE) 309 if (c->size < PAGE_SIZE)
319 b = slob_alloc(c->size, flags, c->align); 310 b = slob_alloc(c->size, flags, c->align);
320 else 311 else
321 b = (void *)__get_free_pages(flags, find_order(c->size)); 312 b = (void *)__get_free_pages(flags, get_order(c->size));
322 313
323 if (c->ctor) 314 if (c->ctor)
324 c->ctor(b, c, SLAB_CTOR_CONSTRUCTOR); 315 c->ctor(b, c, SLAB_CTOR_CONSTRUCTOR);
@@ -345,7 +336,7 @@ void kmem_cache_free(struct kmem_cache *c, void *b)
345 if (c->size < PAGE_SIZE) 336 if (c->size < PAGE_SIZE)
346 slob_free(b, c->size); 337 slob_free(b, c->size);
347 else 338 else
348 free_pages((unsigned long)b, find_order(c->size)); 339 free_pages((unsigned long)b, get_order(c->size));
349} 340}
350EXPORT_SYMBOL(kmem_cache_free); 341EXPORT_SYMBOL(kmem_cache_free);
351 342