[CRIU] [PATCH 5/5] uffd: Relax counting the number of sockets

Pavel Emelyanov xemul at virtuozzo.com
Mon Nov 21 03:27:11 PST 2016


Signed-off-by: Pavel Emelyanov <xemul at virtuozzo.com>
---
 criu/uffd.c | 15 ++++-----------
 1 file changed, 4 insertions(+), 11 deletions(-)

diff --git a/criu/uffd.c b/criu/uffd.c
index a3c72aa..6bf3897 100644
--- a/criu/uffd.c
+++ b/criu/uffd.c
@@ -108,13 +108,6 @@ static void lpi_fini(struct lazy_pages_info *lpi)
 	free(lpi);
 }
 
-static int epoll_nr_fds(int nr_tasks)
-{
-       if (opts.use_page_server)
-               return nr_tasks + 1;
-       return nr_tasks;
-}
-
 static int prepare_sock_addr(struct sockaddr_un *saddr)
 {
 	int len;
@@ -730,12 +723,12 @@ static int lazy_pages_summary(struct lazy_pages_info *lpi)
 
 #define POLL_TIMEOUT 5000
 
-static int handle_requests(int epollfd, struct epoll_event *events)
+static int handle_requests(int epollfd, struct epoll_event *events, int nr_fds)
 {
 	struct lazy_pages_info *lpi;
 	int ret;
 
-	ret = epoll_run_rfds(epollfd, events, epoll_nr_fds(task_entries->nr_tasks), POLL_TIMEOUT);
+	ret = epoll_run_rfds(epollfd, events, nr_fds, POLL_TIMEOUT);
 	if (ret < 0)
 		goto out;
 
@@ -887,7 +880,7 @@ int cr_lazy_pages(bool daemon)
 		}
 	}
 
-	nr_fds = epoll_nr_fds(task_entries->nr_tasks);
+	nr_fds = task_entries->nr_tasks + (opts.use_page_server ? 1 : 0);
 	epollfd = prepare_epoll(nr_fds, &events);
 	if (epollfd < 0)
 		return -1;
@@ -900,7 +893,7 @@ int cr_lazy_pages(bool daemon)
 			return -1;
 	}
 
-	ret = handle_requests(epollfd, events);
+	ret = handle_requests(epollfd, events, nr_fds);
 
 	return ret;
 }
-- 
2.5.0



More information about the CRIU mailing list