diff options
-rw-r--r-- | mm/slob.c | 15 |
1 files changed, 3 insertions, 12 deletions
@@ -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 | ||
153 | static int FASTCALL(find_order(int size)); | ||
154 | static int fastcall find_order(int size) | ||
155 | { | ||
156 | int order = 0; | ||
157 | for ( ; size > 4096 ; size >>=1) | ||
158 | order++; | ||
159 | return order; | ||
160 | } | ||
161 | |||
162 | void *__kmalloc(size_t size, gfp_t gfp) | 153 | void *__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 | } |
350 | EXPORT_SYMBOL(kmem_cache_free); | 341 | EXPORT_SYMBOL(kmem_cache_free); |
351 | 342 | ||