[CRIU] [PATCH v3 1/2] check/servise: use cached kdat values for features check
Mike Rapoport
rppt at linux.vnet.ibm.com
Wed Aug 16 10:32:25 MSK 2017
The kerndat_init() is now called before the jump to action handler. This
allows us to directly use kdat without calling to the corresponding
kerndat_*() methods.
Signed-off-by: Mike Rapoport <rppt at linux.vnet.ibm.com>
---
criu/cr-check.c | 39 ---------------------------------------
criu/cr-service.c | 23 ++++-------------------
2 files changed, 4 insertions(+), 58 deletions(-)
diff --git a/criu/cr-check.c b/criu/cr-check.c
index b1de144..caf6422 100644
--- a/criu/cr-check.c
+++ b/criu/cr-check.c
@@ -676,9 +676,6 @@ static int check_ptrace_dump_seccomp_filters(void)
static int check_mem_dirty_track(void)
{
- if (kerndat_get_dirty_track() < 0)
- return -1;
-
if (!kdat.has_dirty_track) {
pr_warn("Dirty tracking is OFF. Memory snapshot will not work.\n");
return -1;
@@ -772,9 +769,6 @@ static int check_aio_remap(void)
static int check_fdinfo_lock(void)
{
- if (kerndat_fdinfo_has_lock())
- return -1;
-
if (!kdat.has_fdinfo_lock) {
pr_err("fdinfo doesn't contain the lock field\n");
return -1;
@@ -931,12 +925,6 @@ out:
static int check_tcp_halt_closed(void)
{
- int ret;
-
- ret = kerndat_tcp_repair();
- if (ret < 0)
- return -1;
-
if (!kdat.has_tcp_half_closed) {
pr_err("TCP_REPAIR can't be enabled for half-closed sockets\n");
return -1;
@@ -1023,9 +1011,6 @@ static int check_userns(void)
static int check_loginuid(void)
{
- if (kerndat_loginuid() < 0)
- return -1;
-
if (kdat.luid != LUID_FULL) {
pr_warn("Loginuid restore is OFF.\n");
return -1;
@@ -1048,9 +1033,6 @@ static int check_compat_cr(void)
static int check_uffd(void)
{
- if (kerndat_uffd())
- return -1;
-
if (!kdat.has_uffd) {
pr_err("UFFD is not supported\n");
return -1;
@@ -1079,9 +1061,6 @@ static int check_uffd_noncoop(void)
static int check_sk_netns(void)
{
- if (kerndat_socket_netns() < 0)
- return -1;
-
if (!kdat.sk_ns)
return -1;
@@ -1090,9 +1069,6 @@ static int check_sk_netns(void)
static int check_ns_pid(void)
{
- if (kerndat_has_nspid() < 0)
- return -1;
-
if (!kdat.has_nspid)
return -1;
@@ -1101,9 +1077,6 @@ static int check_ns_pid(void)
static int check_ns_get_userns(void)
{
- if (kerndat_has_ns_get_userns() < 0)
- return -1;
-
if (!kdat.has_ns_get_userns)
return -1;
@@ -1112,9 +1085,6 @@ static int check_ns_get_userns(void)
static int check_ns_get_parent(void)
{
- if (kerndat_has_ns_get_parent() < 0)
- return -1;
-
if (!kdat.has_ns_get_parent)
return -1;
@@ -1123,9 +1093,6 @@ static int check_ns_get_parent(void)
static int check_pid_for_children_ns(void)
{
- if (kerndat_has_pid_for_children_ns() < 0)
- return -1;
-
if (!kdat.has_pid_for_children_ns)
return -1;
@@ -1282,9 +1249,6 @@ static int check_tun(void)
static int check_nsid(void)
{
- if (kerndat_nsid() < 0)
- return -1;
-
if (!kdat.has_nsid) {
pr_warn("NSID isn't supported\n");
return -1;
@@ -1295,9 +1259,6 @@ static int check_nsid(void)
static int check_link_nsid(void)
{
- if (kerndat_link_nsid() < 0)
- return -1;
-
if (!kdat.has_link_nsid) {
pr_warn("NSID isn't supported\n");
return -1;
diff --git a/criu/cr-service.c b/criu/cr-service.c
index 18ba2fd..f0bdfa8 100644
--- a/criu/cr-service.c
+++ b/criu/cr-service.c
@@ -883,22 +883,11 @@ static int handle_feature_check(int sk, CriuReq * msg)
setproctitle("feature-check --rpc");
if ((msg->features->has_mem_track == 1) &&
- (msg->features->mem_track == true)) {
-
- feat.mem_track = true;
- ret = kerndat_get_dirty_track();
-
- if (ret)
- feat.mem_track = false;
-
- if (!kdat.has_dirty_track)
- feat.mem_track = false;
- }
+ (msg->features->mem_track == true))
+ feat.mem_track = kdat.has_dirty_track;
if ((msg->features->has_lazy_pages == 1) &&
- (msg->features->lazy_pages == true)) {
- ret = kerndat_uffd();
-
+ (msg->features->lazy_pages == true))
/*
* Not checking for specific UFFD features yet.
* If no error is returned it is probably
@@ -906,11 +895,7 @@ static int handle_feature_check(int sk, CriuReq * msg)
* be extended in the future for a more detailed
* UFFD feature check.
*/
- if (ret || !kdat.has_uffd)
- feat.lazy_pages = false;
- else
- feat.lazy_pages = true;
- }
+ feat.lazy_pages = kdat.has_uffd;
resp.features = &feat;
resp.type = msg->type;
--
2.7.4
More information about the CRIU
mailing list