[CRIU] [RFC PATCH 05/20] criu/plugin: Optimize the proto image size

Felix Kuehling Felix.Kuehling at amd.com
Sat May 1 04:58:30 MSK 2021


From: Rajneesh Bhardwaj <rajneesh.bhardwaj at amd.com>

Userptr buffer objects are system memory that criu handles so no need to
allocate space for such buffer objects. We should allocate space only
for GTT and VRAM memory since that is what we should save in our kfd
image file. The contents for userptr buffer objects will be drained by
criu via vmsplice since those are paged system memory and saved as
regular pages-*.img files.

Signed-off-by: Rajneesh Bhardwaj <rajneesh.bhardwaj at amd.com>
---
 test/others/ext-kfd/kfd_plugin.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/test/others/ext-kfd/kfd_plugin.c b/test/others/ext-kfd/kfd_plugin.c
index 13673a528..67b11ad40 100644
--- a/test/others/ext-kfd/kfd_plugin.c
+++ b/test/others/ext-kfd/kfd_plugin.c
@@ -143,8 +143,13 @@ static int allocate_bo_info_test(CriuKfd *e, int num_bos, struct kfd_criu_bo_buc
 
 		bo_entries_test__init(botest);
 
-		botest->bo_rawdata.data = xmalloc((bo_bucket_ptr)[i].bo_size);
-		botest->bo_rawdata.len = (bo_bucket_ptr)[i].bo_size;
+		if ((bo_bucket_ptr)[i].bo_alloc_flags &
+		    KFD_IOC_ALLOC_MEM_FLAGS_VRAM ||
+		    (bo_bucket_ptr)[i].bo_alloc_flags &
+		    KFD_IOC_ALLOC_MEM_FLAGS_GTT) {
+			botest->bo_rawdata.data = xmalloc((bo_bucket_ptr)[i].bo_size);
+			botest->bo_rawdata.len = (bo_bucket_ptr)[i].bo_size;
+		}
 
 		e->bo_info_test[i] = botest;
 		e->n_bo_info_test++;
-- 
2.17.1



More information about the CRIU mailing list