Commit 8bea49a7 authored by Cyrill Gorcunov's avatar Cyrill Gorcunov Committed by Pavel Emelyanov

pagemap-cache: Use page.h helpers

Signed-off-by: 's avatarCyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent e252e372
...@@ -2,14 +2,14 @@ ...@@ -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 */
......
...@@ -108,7 +108,7 @@ static inline bool page_in_parent(u64 pme) ...@@ -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 @@ ...@@ -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) ...@@ -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)
......
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