etmem/0062-fix-etmem-build-problem.patch
liubo fe6d2a0135 etmem: sync source repo submission
Sync the features and bug fixed in the etmem
source repository.

Signed-off-by: liubo <liubo254@huawei.com>
(cherry picked from commit 07dd6a411bce9ed3d9f617a6f01ae076e24a3adf)
2022-10-12 10:10:23 +08:00

59 lines
2.1 KiB
Diff

From 37264d5a2f7fe27092b0f8d2e834a70e3108a68d Mon Sep 17 00:00:00 2001
From: liubo <liubo254@huawei.com>
Date: Sat, 15 Jan 2022 15:01:47 +0800
Subject: [PATCH 12/33] fix etmem build problem
---
etmem/src/etmemd_src/etmemd_memdcd.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/etmem/src/etmemd_src/etmemd_memdcd.c b/etmem/src/etmemd_src/etmemd_memdcd.c
index 28590e2..7e2f657 100644
--- a/etmem/src/etmemd_src/etmemd_memdcd.c
+++ b/etmem/src/etmemd_src/etmemd_memdcd.c
@@ -243,6 +243,7 @@ static struct page_refs *memdcd_do_scan(const struct task_pid *tpid, const struc
int ret = 0;
char pid[PID_STR_MAX_LEN] = {0};
char *us = "us";
+ struct page_scan *page_scan = NULL;
if(tpid == NULL) {
etmemd_log(ETMEMD_LOG_ERR, "task pid is null\n");
@@ -254,6 +255,8 @@ static struct page_refs *memdcd_do_scan(const struct task_pid *tpid, const struc
return NULL;
}
+ page_scan = (struct page_scan *)tk->eng->proj->scan_param;
+
if (snprintf_s(pid, PID_STR_MAX_LEN, PID_STR_MAX_LEN - 1, "%u", tpid->pid) <= 0) {
etmemd_log(ETMEMD_LOG_ERR, "snprintf pid fail %u", tpid->pid);
return NULL;
@@ -266,7 +269,7 @@ static struct page_refs *memdcd_do_scan(const struct task_pid *tpid, const struc
}
/* loop for scanning idle_pages to get result of memory access. */
- for (i = 0; i < tk->eng->proj->loop; i++) {
+ for (i = 0; i < page_scan->loop; i++) {
ret = get_page_refs(vmas, pid, &page_refs, NULL, 0);
if (ret != 0) {
etmemd_log(ETMEMD_LOG_ERR, "scan operation failed\n");
@@ -275,7 +278,7 @@ static struct page_refs *memdcd_do_scan(const struct task_pid *tpid, const struc
page_refs = NULL;
break;
}
- sleep((unsigned)tk->eng->proj->sleep);
+ sleep((unsigned)page_scan->sleep);
}
free_vmas(vmas);
@@ -419,4 +422,4 @@ int fill_engine_type_memdcd(struct engine *eng, GKeyFile *config)
eng->engine_type = MEMDCD_ENGINE;
eng->name = "memdcd";
return 0;
-}
\ No newline at end of file
+}
--
1.8.3.1