mirror of
https://github.com/checkpoint-restore/criu
synced 2025-08-22 09:58:09 +00:00
pagemap-cache: Use page.h helpers
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org> Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
parent
e252e37201
commit
8bea49a74b
@ -2,14 +2,14 @@
|
|||||||
#define __CR_PAGEMAP_H__
|
#define __CR_PAGEMAP_H__
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include "asm/types.h"
|
#include "asm-generic/page.h"
|
||||||
|
#include "asm/int.h"
|
||||||
|
|
||||||
#include "list.h"
|
#include "list.h"
|
||||||
|
|
||||||
struct vma_area;
|
struct vma_area;
|
||||||
|
|
||||||
#define PAGEMAP_PFN(addr) ((addr) / PAGE_SIZE)
|
#define PAGEMAP_PFN_OFF(addr) (PAGE_PFN(addr) * sizeof(u64))
|
||||||
#define PAGEMAP_PFN_OFF(addr) (PAGEMAP_PFN(addr) * sizeof(u64))
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
pid_t pid; /* which process it belongs */
|
pid_t pid; /* which process it belongs */
|
||||||
|
2
mem.c
2
mem.c
@ -108,7 +108,7 @@ static inline bool page_in_parent(u64 pme)
|
|||||||
|
|
||||||
static int generate_iovs(struct vma_area *vma, struct page_pipe *pp, u64 *map, u64 *off)
|
static int generate_iovs(struct vma_area *vma, struct page_pipe *pp, u64 *map, u64 *off)
|
||||||
{
|
{
|
||||||
u64 *at = &map[PAGEMAP_PFN(*off)];
|
u64 *at = &map[PAGE_PFN(*off)];
|
||||||
unsigned long pfn, nr_to_scan;
|
unsigned long pfn, nr_to_scan;
|
||||||
unsigned long pages[2] = {};
|
unsigned long pages[2] = {};
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
#define PMC_MASK (~(PMC_SIZE - 1))
|
#define PMC_MASK (~(PMC_SIZE - 1))
|
||||||
#define PMC_SIZE_GAP (PMC_SIZE / 4)
|
#define PMC_SIZE_GAP (PMC_SIZE / 4)
|
||||||
|
|
||||||
#define PAGEMAP_LEN(addr) (PAGEMAP_PFN(addr) * sizeof(u64))
|
#define PAGEMAP_LEN(addr) (PAGE_PFN(addr) * sizeof(u64))
|
||||||
|
|
||||||
static inline void pmc_reset(pmc_t *pmc)
|
static inline void pmc_reset(pmc_t *pmc)
|
||||||
{
|
{
|
||||||
@ -56,7 +56,7 @@ int pmc_init(pmc_t *pmc, pid_t pid, struct list_head *vma_head, size_t size)
|
|||||||
|
|
||||||
static inline u64 *__pmc_get_map(pmc_t *pmc, unsigned long addr)
|
static inline u64 *__pmc_get_map(pmc_t *pmc, unsigned long addr)
|
||||||
{
|
{
|
||||||
return &pmc->map[PAGEMAP_PFN(addr - pmc->start)];
|
return &pmc->map[PAGE_PFN(addr - pmc->start)];
|
||||||
}
|
}
|
||||||
|
|
||||||
static int pmc_fill_cache(pmc_t *pmc, struct vma_area *vma)
|
static int pmc_fill_cache(pmc_t *pmc, struct vma_area *vma)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user