Re: [PATCH] mm/vmalloc: add vm_struct for vm_map_ram area

From: Andrew Morton
Date: Wed Jul 19 2017 - 16:50:21 EST


On Wed, 19 Jul 2017 18:44:03 +0800 Zhaoyang Huang <huangzhaoyang@xxxxxxxxx> wrote:

> /proc/vmallocinfo will not show the area allocated by vm_map_ram, which
> will make confusion when debug. Add vm_struct for them and show them in
> proc.
>

Please provide sample /proc/vmallocinfo so we can better understand the
proposal. Is there a means by which people can determine that a
particular area is from vm_map_ram()? I don't think so. Should there
be?

>
> ...
>
> @@ -1173,6 +1178,12 @@ void *vm_map_ram(struct page **pages, unsigned int count, int node, pgprot_t pro
> addr = (unsigned long)mem;
> } else {
> struct vmap_area *va;
> + struct vm_struct *area;
> +
> + area = kzalloc_node(sizeof(*area), GFP_KERNEL, node);
> + if (unlikely(!area))
> + return NULL;

Allocating a vm_struct for each vm_map_ram area is a cost. And we're
doing this purely for /proc/vmallocinfo. I think I'll need more
persuading to convince me that this is a good tradeoff, given that
*every* user will incur this cost, and approximately 0% of them will
ever use /proc/vmallocinfo.

So... do we *really* need this? If so, why?