summaryrefslogtreecommitdiff
path: root/mm/vmalloc.c
diff options
context:
space:
mode:
Diffstat (limited to 'mm/vmalloc.c')
-rw-r--r--mm/vmalloc.c56
1 files changed, 29 insertions, 27 deletions
diff --git a/mm/vmalloc.c b/mm/vmalloc.c
index 859e6d2d57a3..e09d6c8c8b35 100644
--- a/mm/vmalloc.c
+++ b/mm/vmalloc.c
@@ -5345,7 +5345,7 @@ static void show_purge_info(struct seq_file *m)
}
}
-static int vmalloc_info_show(struct seq_file *m, void *p)
+static void show_busy_info(struct seq_file *m)
{
struct vmap_node *vn;
struct vmap_area *va;
@@ -5415,12 +5415,18 @@ static int vmalloc_info_show(struct seq_file *m, void *p)
spin_unlock(&vn->busy.lock);
}
+ if (IS_ENABLED(CONFIG_NUMA))
+ kfree(counters);
+}
+
+static int vmalloc_info_show(struct seq_file *m, void *p)
+{
+ show_busy_info(m);
+
/*
* As a final step, dump "unpurged" areas.
*/
show_purge_info(m);
- if (IS_ENABLED(CONFIG_NUMA))
- kfree(counters);
return 0;
}
@@ -5433,11 +5439,23 @@ module_init(proc_vmalloc_init);
#endif
+static void __init vmap_insert_free_area(unsigned long start, unsigned long end)
+{
+ struct vmap_area *free = kmem_cache_zalloc(vmap_area_cachep, GFP_NOWAIT);
+
+ if (!WARN_ON_ONCE(!free)) {
+ free->va_start = start;
+ free->va_end = end;
+ insert_vmap_area_augment(free, NULL,
+ &free_vmap_area_root,
+ &free_vmap_area_list);
+ }
+}
+
static void __init vmap_init_free_space(void)
{
unsigned long vmap_start = 1;
const unsigned long vmap_end = ULONG_MAX;
- struct vmap_area *free;
struct vm_struct *busy;
/*
@@ -5447,32 +5465,15 @@ static void __init vmap_init_free_space(void)
* |<--------------------------------->|
*/
for (busy = vmlist; busy; busy = busy->next) {
- if ((unsigned long) busy->addr - vmap_start > 0) {
- free = kmem_cache_zalloc(vmap_area_cachep, GFP_NOWAIT);
- if (!WARN_ON_ONCE(!free)) {
- free->va_start = vmap_start;
- free->va_end = (unsigned long) busy->addr;
-
- insert_vmap_area_augment(free, NULL,
- &free_vmap_area_root,
- &free_vmap_area_list);
- }
- }
+ if ((unsigned long) busy->addr - vmap_start > 0)
+ vmap_insert_free_area(vmap_start,
+ (unsigned long) busy->addr);
vmap_start = (unsigned long) busy->addr + busy->size;
}
- if (vmap_end - vmap_start > 0) {
- free = kmem_cache_zalloc(vmap_area_cachep, GFP_NOWAIT);
- if (!WARN_ON_ONCE(!free)) {
- free->va_start = vmap_start;
- free->va_end = vmap_end;
-
- insert_vmap_area_augment(free, NULL,
- &free_vmap_area_root,
- &free_vmap_area_list);
- }
- }
+ if (vmap_end - vmap_start > 0)
+ vmap_insert_free_area(vmap_start, vmap_end);
}
static void vmap_init_nodes(void)
@@ -5585,10 +5586,11 @@ void __init vmalloc_init(void)
vbq = &per_cpu(vmap_block_queue, i);
spin_lock_init(&vbq->lock);
INIT_LIST_HEAD(&vbq->free);
+ xa_init(&vbq->vmap_blocks);
+
p = &per_cpu(vfree_deferred, i);
init_llist_head(&p->list);
INIT_WORK(&p->wq, delayed_vfree_work);
- xa_init(&vbq->vmap_blocks);
}
/*