加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0007-fix-error-when-open-idle_pages-failed.patch 1.95 KB
一键复制 编辑 原始数据 按行查看 历史
yangxin 提交于 2021-09-30 22:57 . Update etmem.
From 910519ccf986b80a7ee5a5aab90b62828bdc8b84 Mon Sep 17 00:00:00 2001
From: Kemeng Shi <shikemeng@huawei.com>
Date: Wed, 28 Apr 2021 09:54:06 +0800
Subject: [PATCH 07/50] fix error when open idle_pages failed
Signed-off-by: Kemeng Shi <shikemeng@huawei.com>
---
src/etmemd_src/etmemd_cslide.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/etmemd_src/etmemd_cslide.c b/src/etmemd_src/etmemd_cslide.c
index 3983a32..618cafe 100644
--- a/src/etmemd_src/etmemd_cslide.c
+++ b/src/etmemd_src/etmemd_cslide.c
@@ -1281,7 +1281,6 @@ static int cslide_scan_vmas(struct cslide_pid_params *params)
scan_fp = etmemd_get_proc_file(pid, IDLE_SCAN_FILE, SCAN_AS_HUGE, "r");
if (scan_fp == NULL) {
etmemd_log(ETMEMD_LOG_ERR, "open %s file for pid %u fail\n", IDLE_SCAN_FILE, params->pid);
- params->vma_pf = NULL;
return -1;
}
@@ -1298,7 +1297,6 @@ static int cslide_scan_vmas(struct cslide_pid_params *params)
walk_address.walk_end = vma->end;
if (walk_vmas(fd, &walk_address, &vma_pf->page_refs, NULL) == NULL) {
etmemd_log(ETMEMD_LOG_ERR, "scan vma start %llu end %llu fail\n", vma->start, vma->end);
- cslide_free_vmas(params);
fclose(scan_fp);
return -1;
}
@@ -1308,6 +1306,8 @@ static int cslide_scan_vmas(struct cslide_pid_params *params)
return 0;
}
+// allocted data will be cleaned in cslide_main->cslide_clean_params
+// ->cslide_free_vmas
static int cslide_do_scan(struct cslide_eng_params *eng_params)
{
struct cslide_pid_params *iter = NULL;
@@ -1531,7 +1531,9 @@ static void cslide_clean_params(struct cslide_eng_params *eng_params)
struct cslide_pid_params *iter = NULL;
factory_foreach_pid_params(iter, &eng_params->factory) {
+ // clean memory allocted in cslide_policy
clean_pid_param(iter);
+ // clean memory allocted in cslide_do_scan
cslide_free_vmas(iter);
}
}
--
2.27.0
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化