aboutsummaryrefslogtreecommitdiffstats
path: root/mm/vmalloc.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2015-11-01 20:09:15 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2015-11-01 20:09:15 -0500
commita5ad88ce8c7fae7ddc72ee49a11a75aa837788e0 (patch)
treebee1a3c26d1ab51da0a61059cc8994d84defbc2a /mm/vmalloc.c
parent2e002662973fd8d67d5a760776a5d3ea3d3399a9 (diff)
mm: get rid of 'vmalloc_info' from /proc/meminfo
It turns out that at least some versions of glibc end up reading /proc/meminfo at every single startup, because glibc wants to know the amount of memory the machine has. And while that's arguably insane, it's just how things are. And it turns out that it's not all that expensive most of the time, but the vmalloc information statistics (amount of virtual memory used in the vmalloc space, and the biggest remaining chunk) can be rather expensive to compute. The 'get_vmalloc_info()' function actually showed up on my profiles as 4% of the CPU usage of "make test" in the git source repository, because the git tests are lots of very short-lived shell-scripts etc. It turns out that apparently this same silly vmalloc info gathering shows up on the facebook servers too, according to Dave Jones. So it's not just "make test" for git. We had two patches to just cache the information (one by me, one by Ingo) to mitigate this issue, but the whole vmalloc information of of rather dubious value to begin with, and people who *actually* want to know what the situation is wrt the vmalloc area should just look at the much more complete /proc/vmallocinfo instead. In fact, according to my testing - and perhaps more importantly, according to that big search engine in the sky: Google - there is nothing out there that actually cares about those two expensive fields: VmallocUsed and VmallocChunk. So let's try to just remove them entirely. Actually, this just removes the computation and reports the numbers as zero for now, just to try to be minimally intrusive. If this breaks anything, we'll obviously have to re-introduce the code to compute this all and add the caching patches on top. But if given the option, I'd really prefer to just remove this bad idea entirely rather than add even more code to work around our historical mistake that likely nobody really cares about. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/vmalloc.c')
-rw-r--r--mm/vmalloc.c47
1 files changed, 0 insertions, 47 deletions
diff --git a/mm/vmalloc.c b/mm/vmalloc.c
index 2faaa2976447..af3a519e40c2 100644
--- a/mm/vmalloc.c
+++ b/mm/vmalloc.c
@@ -2688,52 +2688,5 @@ static int __init proc_vmalloc_init(void)
2688} 2688}
2689module_init(proc_vmalloc_init); 2689module_init(proc_vmalloc_init);
2690 2690
2691void get_vmalloc_info(struct vmalloc_info *vmi)
2692{
2693 struct vmap_area *va;
2694 unsigned long free_area_size;
2695 unsigned long prev_end;
2696
2697 vmi->used = 0;
2698 vmi->largest_chunk = 0;
2699
2700 prev_end = VMALLOC_START;
2701
2702 rcu_read_lock();
2703
2704 if (list_empty(&vmap_area_list)) {
2705 vmi->largest_chunk = VMALLOC_TOTAL;
2706 goto out;
2707 }
2708
2709 list_for_each_entry_rcu(va, &vmap_area_list, list) {
2710 unsigned long addr = va->va_start;
2711
2712 /*
2713 * Some archs keep another range for modules in vmalloc space
2714 */
2715 if (addr < VMALLOC_START)
2716 continue;
2717 if (addr >= VMALLOC_END)
2718 break;
2719
2720 if (va->flags & (VM_LAZY_FREE | VM_LAZY_FREEING))
2721 continue;
2722
2723 vmi->used += (va->va_end - va->va_start);
2724
2725 free_area_size = addr - prev_end;
2726 if (vmi->largest_chunk < free_area_size)
2727 vmi->largest_chunk = free_area_size;
2728
2729 prev_end = va->va_end;
2730 }
2731
2732 if (VMALLOC_END - prev_end > vmi->largest_chunk)
2733 vmi->largest_chunk = VMALLOC_END - prev_end;
2734
2735out:
2736 rcu_read_unlock();
2737}
2738#endif 2691#endif
2739 2692