projects
/
cascardo
/
linux.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
mm: coalesce split strings
[cascardo/linux.git]
/
mm
/
percpu.c
diff --git
a/mm/percpu.c
b/mm/percpu.c
index
8a943b9
..
1571547
100644
(file)
--- a/
mm/percpu.c
+++ b/
mm/percpu.c
@@
-305,16
+305,12
@@
static void *pcpu_mem_zalloc(size_t size)
/**
* pcpu_mem_free - free memory
* @ptr: memory to free
/**
* pcpu_mem_free - free memory
* @ptr: memory to free
- * @size: size of the area
*
* Free @ptr. @ptr should have been allocated using pcpu_mem_zalloc().
*/
*
* Free @ptr. @ptr should have been allocated using pcpu_mem_zalloc().
*/
-static void pcpu_mem_free(void *ptr
, size_t size
)
+static void pcpu_mem_free(void *ptr)
{
{
- if (size <= PAGE_SIZE)
- kfree(ptr);
- else
- vfree(ptr);
+ kvfree(ptr);
}
/**
}
/**
@@
-463,8
+459,8
@@
out_unlock:
* pcpu_mem_free() might end up calling vfree() which uses
* IRQ-unsafe lock and thus can't be called under pcpu_lock.
*/
* pcpu_mem_free() might end up calling vfree() which uses
* IRQ-unsafe lock and thus can't be called under pcpu_lock.
*/
- pcpu_mem_free(old
, old_size
);
- pcpu_mem_free(new
, new_size
);
+ pcpu_mem_free(old);
+ pcpu_mem_free(new);
return 0;
}
return 0;
}
@@
-732,7
+728,7
@@
static struct pcpu_chunk *pcpu_alloc_chunk(void)
chunk->map = pcpu_mem_zalloc(PCPU_DFL_MAP_ALLOC *
sizeof(chunk->map[0]));
if (!chunk->map) {
chunk->map = pcpu_mem_zalloc(PCPU_DFL_MAP_ALLOC *
sizeof(chunk->map[0]));
if (!chunk->map) {
- pcpu_mem_free(chunk
, pcpu_chunk_struct_size
);
+ pcpu_mem_free(chunk);
return NULL;
}
return NULL;
}
@@
-753,8
+749,8
@@
static void pcpu_free_chunk(struct pcpu_chunk *chunk)
{
if (!chunk)
return;
{
if (!chunk)
return;
- pcpu_mem_free(chunk->map
, chunk->map_alloc * sizeof(chunk->map[0])
);
- pcpu_mem_free(chunk
, pcpu_chunk_struct_size
);
+ pcpu_mem_free(chunk->map);
+ pcpu_mem_free(chunk);
}
/**
}
/**
@@
-892,8
+888,8
@@
static void __percpu *pcpu_alloc(size_t size, size_t align, bool reserved,
size = ALIGN(size, 2);
if (unlikely(!size || size > PCPU_MIN_UNIT_SIZE || align > PAGE_SIZE)) {
size = ALIGN(size, 2);
if (unlikely(!size || size > PCPU_MIN_UNIT_SIZE || align > PAGE_SIZE)) {
- WARN(true, "illegal size (%zu) or align (%zu) for
"
-
"percpu allocation\n",
size, align);
+ WARN(true, "illegal size (%zu) or align (%zu) for
percpu allocation\n",
+ size, align);
return NULL;
}
return NULL;
}
@@
-1037,8
+1033,8
@@
fail_unlock:
spin_unlock_irqrestore(&pcpu_lock, flags);
fail:
if (!is_atomic && warn_limit) {
spin_unlock_irqrestore(&pcpu_lock, flags);
fail:
if (!is_atomic && warn_limit) {
- pr_warn
ing
("PERCPU: allocation failed, size=%zu align=%zu atomic=%d, %s\n",
-
size, align, is_atomic, err);
+ pr_warn("PERCPU: allocation failed, size=%zu align=%zu atomic=%d, %s\n",
+ size, align, is_atomic, err);
dump_stack();
if (!--warn_limit)
pr_info("PERCPU: limit reached, disable warning\n");
dump_stack();
if (!--warn_limit)
pr_info("PERCPU: limit reached, disable warning\n");
@@
-1727,7
+1723,7
@@
static int __init percpu_alloc_setup(char *str)
pcpu_chosen_fc = PCPU_FC_PAGE;
#endif
else
pcpu_chosen_fc = PCPU_FC_PAGE;
#endif
else
- pr_warn
ing
("PERCPU: unknown allocator %s specified\n", str);
+ pr_warn("PERCPU: unknown allocator %s specified\n", str);
return 0;
}
return 0;
}
@@
-2020,9
+2016,8
@@
int __init pcpu_embed_first_chunk(size_t reserved_size, size_t dyn_size,
/* warn if maximum distance is further than 75% of vmalloc space */
if (max_distance > VMALLOC_TOTAL * 3 / 4) {
/* warn if maximum distance is further than 75% of vmalloc space */
if (max_distance > VMALLOC_TOTAL * 3 / 4) {
- pr_warning("PERCPU: max_distance=0x%zx too large for vmalloc "
- "space 0x%lx\n", max_distance,
- VMALLOC_TOTAL);
+ pr_warn("PERCPU: max_distance=0x%zx too large for vmalloc space 0x%lx\n",
+ max_distance, VMALLOC_TOTAL);
#ifdef CONFIG_NEED_PER_CPU_PAGE_FIRST_CHUNK
/* and fail if we have fallback */
rc = -EINVAL;
#ifdef CONFIG_NEED_PER_CPU_PAGE_FIRST_CHUNK
/* and fail if we have fallback */
rc = -EINVAL;
@@
-2104,8
+2099,8
@@
int __init pcpu_page_first_chunk(size_t reserved_size,
ptr = alloc_fn(cpu, PAGE_SIZE, PAGE_SIZE);
if (!ptr) {
ptr = alloc_fn(cpu, PAGE_SIZE, PAGE_SIZE);
if (!ptr) {
- pr_warn
ing("PERCPU: failed to allocate %s page "
-
"for cpu%u\n",
psize_str, cpu);
+ pr_warn
("PERCPU: failed to allocate %s page for cpu%u\n",
+ psize_str, cpu);
goto enomem;
}
/* kmemleak tracks the percpu allocations separately */
goto enomem;
}
/* kmemleak tracks the percpu allocations separately */