Problem: *** Stephen reported vread() will skip vm_map_ram areas when reading out /proc/kcore with drgn utility. Please see below link to get more about it: /proc/kcore reads 0's for vmap_block https://lore.kernel.org/all/87ilk6gos2.fsf@xxxxxxxxxx/T/#u Root cause: *** The normal vmalloc API uses struct vmap_area to manage the virtual kernel area allocated and associate a vm_struct to store more information and passed out. However, area reserved through vm_map_ram() interface doesn't allocate vm_struct to bind with. So the current code in vread() will skip the vm_map_ram area by 'if (!va->vm)' conditional checking. Solution: *** There are two types of vm_map_ram area. One is the whole vmap_area being reserved and mapped at one time; the other is the whole vmap_area with VMAP_BLOCK_SIZE size being reserved at one time, while mapped into split regions with smaller size several times. In patch 1 and 2, add flags into struct vmap_area to mark these two types of vm_map_ram area, meanwhile add bitmap field used_map into struct vmap_block to mark those regions being used to differentiate with dirty and free regions. With the help of above vmap_area->flags and vmap_block->used_map, we can recognize them in vread() and handle them respectively. Test: *** I don't know what system has vm_map_ram() area. So just pass compiling test and execute "makedumpfile --mem-usage /proc/kcore" to guarantee it won't impact the old kcore reading. [root@ibm-x3950x6-01 ~]# free -h total used free shared buff/cache available Mem: 3.9Ti 3.6Gi 3.9Ti 7.0Mi 497Mi 3.9Ti Swap: 8.0Gi 0B 8.0Gi [root@ibm-x3950x6-01 ~]# makedumpfile --mem-usage /proc/kcore The kernel version is not supported. The makedumpfile operation may be incomplete. TYPE PAGES EXCLUDABLE DESCRIPTION ---------------------------------------------------------------------- ZERO 327309 yes Pages filled with zero NON_PRI_CACHE 81750 yes Cache pages without private flag PRI_CACHE 83981 yes Cache pages with private flag USER 12735 yes User process pages FREE 1055688908 yes Free pages KERN_DATA 17464385 no Dumpable kernel data page size: 4096 Total pages on system: 1073659068 Total size on system: 4397707542528 Byte Baoquan He (3): mm/vmalloc.c: add used_map into vmap_block to track space of vmap_block mm/vmalloc.c: add flags to mark vm_map_ram area mm/vmalloc.c: allow vread() to read out vm_map_ram areas include/linux/vmalloc.h | 1 + mm/vmalloc.c | 81 +++++++++++++++++++++++++++++++++++++---- 2 files changed, 75 insertions(+), 7 deletions(-) -- 2.34.1