Commit bb3d02c2 authored by Pavel Emelyanov's avatar Pavel Emelyanov Committed by Cyrill Gorcunov

crtools: Take MINCORE_ANON pages into account

Reduce the pages-xxx.img file size significantly (from 2.1M to ~100K for simple counter test)
by not dumping private file pages, that have not yet changed from its file prototype.

If you'll have problems with it, just let me know and comment the definition of PAGE_ANON not
to block your work.

This uses the implemented earlier flag from mincore.
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
Signed-off-by: 's avatarCyrill Gorcunov <gorcunov@gmail.com>
parent 605220e7
......@@ -17,6 +17,7 @@
#define PAGE_IMAGE_SIZE 4096
#define PAGE_RSS 1
#define PAGE_ANON 2
struct fdinfo_entry {
u8 type;
......
......@@ -78,7 +78,17 @@ static void sys_write_msg(const char *msg)
static inline int should_dump_page(struct vma_entry *vmae, unsigned char mincore_flags)
{
#ifdef PAGE_ANON
if (vma_entry_is(vmae, VMA_DUMP_ALL))
return 1;
if (vma_entry_is(vmae, VMA_FILE_PRIVATE))
return mincore_flags & PAGE_ANON;
else
return mincore_flags & PAGE_RSS;
#else
return (mincore_flags & PAGE_RSS) || vma_entry_is(vmae, VMA_DUMP_ALL);
#endif
}
/*
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment