Skip to content

Commit 3ee48b6

Browse files
cpwickmanIngo Molnar
authored and
Ingo Molnar
committed
mm, x86: Saving vmcore with non-lazy freeing of vmas
During the reading of /proc/vmcore the kernel is doing ioremap()/iounmap() repeatedly. And the buildup of un-flushed vm_area_struct's is causing a great deal of overhead. (rb_next() is chewing up most of that time). This solution is to provide function set_iounmap_nonlazy(). It causes a subsequent call to iounmap() to immediately purge the vma area (with try_purge_vmap_area_lazy()). With this patch we have seen the time for writing a 250MB compressed dump drop from 71 seconds to 44 seconds. Signed-off-by: Cliff Wickman <[email protected]> Cc: Andrew Morton <[email protected]> Cc: [email protected] Cc: <[email protected]> LKML-Reference: <[email protected]> Signed-off-by: Ingo Molnar <[email protected]>
1 parent 37a2f9f commit 3ee48b6

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed

arch/x86/include/asm/io.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,7 @@ static inline void __iomem *ioremap(resource_size_t offset, unsigned long size)
206206

207207
extern void iounmap(volatile void __iomem *addr);
208208

209+
extern void set_iounmap_nonlazy(void);
209210

210211
#ifdef __KERNEL__
211212

arch/x86/kernel/crash_dump_64.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ ssize_t copy_oldmem_page(unsigned long pfn, char *buf,
4646
} else
4747
memcpy(buf, vaddr + offset, csize);
4848

49+
set_iounmap_nonlazy();
4950
iounmap(vaddr);
5051
return csize;
5152
}

mm/vmalloc.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -516,6 +516,15 @@ static atomic_t vmap_lazy_nr = ATOMIC_INIT(0);
516516
/* for per-CPU blocks */
517517
static void purge_fragmented_blocks_allcpus(void);
518518

519+
/*
520+
* called before a call to iounmap() if the caller wants vm_area_struct's
521+
* immediately freed.
522+
*/
523+
void set_iounmap_nonlazy(void)
524+
{
525+
atomic_set(&vmap_lazy_nr, lazy_max_pages()+1);
526+
}
527+
519528
/*
520529
* Purges all lazily-freed vmap areas.
521530
*

0 commit comments

Comments
 (0)