[CRIU] [PATCH v2 1/5] uffd.c: remove unused variable vma_size
Adrian Reber
adrian at lisas.de
Thu Mar 24 08:52:50 PDT 2016
From: Adrian Reber <areber at redhat.com>
The variable vma_size was used for early debugging of lazy restore and
has no significance now.
Signed-off-by: Adrian Reber <areber at redhat.com>
---
criu/uffd.c | 27 ++++++++-------------------
1 file changed, 8 insertions(+), 19 deletions(-)
diff --git a/criu/uffd.c b/criu/uffd.c
index 69403dd..cdda985 100644
--- a/criu/uffd.c
+++ b/criu/uffd.c
@@ -277,8 +277,7 @@ static int uffd_copy_page(int uffd, __u64 address, void *dest)
}
-static int collect_uffd_pages(struct page_read *pr, struct list_head *uffd_list,
- unsigned long *vma_size)
+static int collect_uffd_pages(struct page_read *pr, struct list_head *uffd_list)
{
unsigned long base;
int i;
@@ -332,7 +331,6 @@ static int collect_uffd_pages(struct page_read *pr, struct list_head *uffd_list,
pr_debug("Adding 0x%lx to our list\n", base);
- *vma_size += ps;
uffd_pages = xzalloc(sizeof(struct uffd_pages_struct));
if (!uffd_pages)
return -1;
@@ -345,14 +343,12 @@ static int collect_uffd_pages(struct page_read *pr, struct list_head *uffd_list,
return 1;
}
-static int handle_remaining_pages(int uffd, struct list_head *uffd_list, unsigned long *vma_size,
- void *dest)
+static int handle_remaining_pages(int uffd, struct list_head *uffd_list, void *dest)
{
unsigned long uffd_copied_pages = 0;
struct uffd_pages_struct *uffd_pages;
int rc;
- pr_debug("remaining vma_size: 0x%lx\n", *vma_size);
pr_debug("uffd_copied_pages: %ld\n", uffd_copied_pages);
list_for_each_entry(uffd_pages, uffd_list, list) {
@@ -366,9 +362,7 @@ static int handle_remaining_pages(int uffd, struct list_head *uffd_list, unsigne
pr_err("Error during UFFD copy\n");
return -1;
}
- *vma_size -= rc;
- pr_debug("remaining vma_size: 0x%lx\n", *vma_size);
uffd_copied_pages++;
uffd_pages->flags |= UFFD_FLAG_SENT;
}
@@ -377,8 +371,7 @@ static int handle_remaining_pages(int uffd, struct list_head *uffd_list, unsigne
}
-static int handle_regular_pages(int uffd, struct list_head *uffd_list, unsigned long *vma_size,
- void *dest, __u64 address)
+static int handle_regular_pages(int uffd, struct list_head *uffd_list, void *dest, __u64 address)
{
int rc;
struct uffd_pages_struct *uffd_pages;
@@ -388,7 +381,6 @@ static int handle_regular_pages(int uffd, struct list_head *uffd_list, unsigned
pr_err("Error during UFFD copy\n");
return -1;
}
- *vma_size -= rc;
/*
* Mark this page as having been already transferred, so
@@ -403,8 +395,7 @@ static int handle_regular_pages(int uffd, struct list_head *uffd_list, unsigned
return 1;
}
-static int handle_vdso_pages(int uffd, struct list_head *uffd_list, unsigned long *vma_size,
- void *dest)
+static int handle_vdso_pages(int uffd, struct list_head *uffd_list, void *dest)
{
int rc;
struct uffd_pages_struct *uffd_pages;
@@ -418,7 +409,6 @@ static int handle_vdso_pages(int uffd, struct list_head *uffd_list, unsigned lon
pr_err("Error during UFFD copy\n");
return -1;
}
- *vma_size -= rc;
uffd_copied_pages++;
uffd_pages->flags |= UFFD_FLAG_SENT;
}
@@ -508,7 +498,6 @@ int uffd_listen()
int uffd_flags;
struct uffd_pages_struct *uffd_pages;
bool vdso_sent = false;
- unsigned long vma_size = 0;
LIST_HEAD(uffd_list);
@@ -555,7 +544,7 @@ int uffd_listen()
* pushed into the process using userfaultfd.
*/
do {
- rc = collect_uffd_pages(&pr, &uffd_list, &vma_size);
+ rc = collect_uffd_pages(&pr, &uffd_list);
if (rc == -1) {
rc = 1;
goto out;
@@ -613,7 +602,7 @@ int uffd_listen()
*/
if (!vdso_sent) {
pr_debug("Pushing VDSO pages once\n");
- rc = handle_vdso_pages(uffd, &uffd_list, &vma_size, dest);
+ rc = handle_vdso_pages(uffd, &uffd_list, dest);
if (rc < 0) {
pr_err("Error during VDSO handling\n");
rc = 1;
@@ -645,7 +634,7 @@ int uffd_listen()
goto out;
}
- rc = handle_regular_pages(uffd, &uffd_list, &vma_size, dest, address);
+ rc = handle_regular_pages(uffd, &uffd_list, dest, address);
if (rc < 0) {
pr_err("Error during regular page copy\n");
rc = 1;
@@ -656,7 +645,7 @@ int uffd_listen()
}
pr_debug("Handle remaining pages\n");
- rc = handle_remaining_pages(uffd, &uffd_list, &vma_size, dest);
+ rc = handle_remaining_pages(uffd, &uffd_list, dest);
if (rc < 0) {
pr_err("Error during remaining page copy\n");
rc = 1;
--
1.8.3.1
More information about the CRIU
mailing list