aboutsummaryrefslogtreecommitdiffstats
path: root/mm
diff options
context:
space:
mode:
Diffstat (limited to 'mm')
-rw-r--r--mm/percpu.c18
1 files changed, 7 insertions, 11 deletions
diff --git a/mm/percpu.c b/mm/percpu.c
index 8a943b97a053..998607adf6eb 100644
--- a/mm/percpu.c
+++ b/mm/percpu.c
@@ -305,16 +305,12 @@ static void *pcpu_mem_zalloc(size_t size)
305/** 305/**
306 * pcpu_mem_free - free memory 306 * pcpu_mem_free - free memory
307 * @ptr: memory to free 307 * @ptr: memory to free
308 * @size: size of the area
309 * 308 *
310 * Free @ptr. @ptr should have been allocated using pcpu_mem_zalloc(). 309 * Free @ptr. @ptr should have been allocated using pcpu_mem_zalloc().
311 */ 310 */
312static void pcpu_mem_free(void *ptr, size_t size) 311static void pcpu_mem_free(void *ptr)
313{ 312{
314 if (size <= PAGE_SIZE) 313 kvfree(ptr);
315 kfree(ptr);
316 else
317 vfree(ptr);
318} 314}
319 315
320/** 316/**
@@ -463,8 +459,8 @@ out_unlock:
463 * pcpu_mem_free() might end up calling vfree() which uses 459 * pcpu_mem_free() might end up calling vfree() which uses
464 * IRQ-unsafe lock and thus can't be called under pcpu_lock. 460 * IRQ-unsafe lock and thus can't be called under pcpu_lock.
465 */ 461 */
466 pcpu_mem_free(old, old_size); 462 pcpu_mem_free(old);
467 pcpu_mem_free(new, new_size); 463 pcpu_mem_free(new);
468 464
469 return 0; 465 return 0;
470} 466}
@@ -732,7 +728,7 @@ static struct pcpu_chunk *pcpu_alloc_chunk(void)
732 chunk->map = pcpu_mem_zalloc(PCPU_DFL_MAP_ALLOC * 728 chunk->map = pcpu_mem_zalloc(PCPU_DFL_MAP_ALLOC *
733 sizeof(chunk->map[0])); 729 sizeof(chunk->map[0]));
734 if (!chunk->map) { 730 if (!chunk->map) {
735 pcpu_mem_free(chunk, pcpu_chunk_struct_size); 731 pcpu_mem_free(chunk);
736 return NULL; 732 return NULL;
737 } 733 }
738 734
@@ -753,8 +749,8 @@ static void pcpu_free_chunk(struct pcpu_chunk *chunk)
753{ 749{
754 if (!chunk) 750 if (!chunk)
755 return; 751 return;
756 pcpu_mem_free(chunk->map, chunk->map_alloc * sizeof(chunk->map[0])); 752 pcpu_mem_free(chunk->map);
757 pcpu_mem_free(chunk, pcpu_chunk_struct_size); 753 pcpu_mem_free(chunk);
758} 754}
759 755
760/** 756/**