[CRIU] [PATCH 1/2] pagemap-cache: Introduce engine

Pavel Emelyanov xemul at parallels.com
Mon Feb 17 10:16:27 PST 2014


On 02/17/2014 12:38 PM, Cyrill Gorcunov wrote:
> 
> Pavel reported that in case if there a big number
> of small vmas present in the dumpee we're reading
> /proc/pid/pagemap too frequently.
> 
> To speedup this procedue we inroduce pagemap cache.
> 
> The interface is:
>  - pmc_init/pmc_fini for cache initialization and freeing
>  - pmc_get_map to retrieve specific PMEs array for VMA area
> 
> Reported-by: Pavel Emelyanov <xemul at parallels.com>
> Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
> ---
>  Makefile.crtools        |   1 +
>  include/pagemap-cache.h |  38 +++++++++++++
>  pagemap-cache.c         | 138 ++++++++++++++++++++++++++++++++++++++++++++++++
>  3 files changed, 177 insertions(+)
>  create mode 100644 include/pagemap-cache.h
>  create mode 100644 pagemap-cache.c
> 


> +#define PAGEMAP_LEN(pages)	((pages) * sizeof(u64))

This one always accepts only PAGEMAP_PFN() argument. Plz, make it work on size
and do / PAGE_SIZE internally.

> +/* To carry up to 2M of physical memory */
> +#define PMC_SHIFT		(21)
> +#define PMC_SIZE		(1ul << PMC_SHIFT)
> +#define PMC_MASK		(~(PMC_SIZE - 1))
> +#define PMC_SIZE_GAP		(PMC_SIZE / 4)

This stuff is internal to pagemap-cache.c. Plz, leave in header only the API.


More information about the CRIU mailing list