Commit 13ba3fcbbe31068b1ee7c39a0b58ecbed03c4d72

Authored by Atsushi Kumagai
Committed by Linus Torvalds
1 parent 4341fa4547

kexec, vmalloc: export additional vmalloc layer information

Now, vmap_area_list is exported as VMCOREINFO for makedumpfile to get
the start address of vmalloc region (vmalloc_start).  The address which
contains vmalloc_start value is represented as below:

  vmap_area_list.next - OFFSET(vmap_area.list) + OFFSET(vmap_area.va_start)

However, both OFFSET(vmap_area.va_start) and OFFSET(vmap_area.list)
aren't exported as VMCOREINFO.

So this patch exports them externally with small cleanup.

[akpm@linux-foundation.org: vmalloc.h should include list.h for list_head]
Signed-off-by: Atsushi Kumagai <kumagai-atsushi@mxc.nes.nec.co.jp>
Cc: Joonsoo Kim <js1304@gmail.com>
Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Atsushi Kumagai <kumagai-atsushi@mxc.nes.nec.co.jp>
Cc: Chris Metcalf <cmetcalf@tilera.com>
Cc: Dave Anderson <anderson@redhat.com>
Cc: Eric Biederman <ebiederm@xmission.com>
Cc: Guan Xuetao <gxt@mprc.pku.edu.cn>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Vivek Goyal <vgoyal@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

Showing 3 changed files with 15 additions and 12 deletions Side-by-side Diff

include/linux/vmalloc.h
... ... @@ -3,7 +3,9 @@
3 3  
4 4 #include <linux/spinlock.h>
5 5 #include <linux/init.h>
  6 +#include <linux/list.h>
6 7 #include <asm/page.h> /* pgprot_t */
  8 +#include <linux/rbtree.h>
7 9  
8 10 struct vm_area_struct; /* vma defining user mapping in mm_types.h */
9 11  
... ... @@ -33,6 +35,17 @@
33 35 unsigned int nr_pages;
34 36 phys_addr_t phys_addr;
35 37 const void *caller;
  38 +};
  39 +
  40 +struct vmap_area {
  41 + unsigned long va_start;
  42 + unsigned long va_end;
  43 + unsigned long flags;
  44 + struct rb_node rb_node; /* address sorted rbtree */
  45 + struct list_head list; /* address sorted list */
  46 + struct list_head purge_list; /* "lazy purge" list */
  47 + struct vm_struct *vm;
  48 + struct rcu_head rcu_head;
36 49 };
37 50  
38 51 /*
... ... @@ -1615,7 +1615,8 @@
1615 1615 VMCOREINFO_OFFSET(free_area, free_list);
1616 1616 VMCOREINFO_OFFSET(list_head, next);
1617 1617 VMCOREINFO_OFFSET(list_head, prev);
1618   - VMCOREINFO_OFFSET(vm_struct, addr);
  1618 + VMCOREINFO_OFFSET(vmap_area, va_start);
  1619 + VMCOREINFO_OFFSET(vmap_area, list);
1619 1620 VMCOREINFO_LENGTH(zone.free_area, MAX_ORDER);
1620 1621 log_buf_kexec_setup();
1621 1622 VMCOREINFO_LENGTH(free_area.free_list, MIGRATE_TYPES);
... ... @@ -249,17 +249,6 @@
249 249 #define VM_LAZY_FREEING 0x02
250 250 #define VM_VM_AREA 0x04
251 251  
252   -struct vmap_area {
253   - unsigned long va_start;
254   - unsigned long va_end;
255   - unsigned long flags;
256   - struct rb_node rb_node; /* address sorted rbtree */
257   - struct list_head list; /* address sorted list */
258   - struct list_head purge_list; /* "lazy purge" list */
259   - struct vm_struct *vm;
260   - struct rcu_head rcu_head;
261   -};
262   -
263 252 static DEFINE_SPINLOCK(vmap_area_lock);
264 253 /* Export for kexec only */
265 254 LIST_HEAD(vmap_area_list);