1 Star 0 Fork 22

wang_yue111/libhugetlbfs

forked from src-openEuler/libhugetlbfs 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
libhugetlbfs-2.16-remap_segments_with_MAP_SHARED.patch 1.06 KB
一键复制 编辑 原始数据 按行查看 历史
hexiaowen 提交于 2019-09-30 10:56 . Package init
From 7c371e7de53554166711e0bcc37df94d0a78edd3 Mon Sep 17 00:00:00 2001
From: sangyan <[email protected]>
Date: Fri, 21 Apr 2017 14:35:03 +0800
Subject: [PATCH] elflink.c: remap segments with MAP_SHARED flag
Mmapping segment with MAP_PRIVATE will create a private
copy-on-write mapping, as a result updates to the mapping
will cost extra pages. It will cost double number of pages
in the worst case, so we change to MAP_SHARED flag.
It is also safe to mmap a unlinked file or a read-only file.
---
elflink.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/elflink.c b/elflink.c
index b746b26..8187ee0 100644
--- a/elflink.c
+++ b/elflink.c
@@ -1131,7 +1131,7 @@ static void remap_segments(struct seg_info *seg, int num)
start = ALIGN_DOWN((unsigned long)seg[i].vaddr, hpage_size);
offset = (unsigned long)(seg[i].vaddr - start);
mapsize = ALIGN(offset + seg[i].memsz, hpage_size);
- mmap_flags = MAP_PRIVATE|MAP_FIXED;
+ mmap_flags = MAP_SHARED|MAP_FIXED;
/* If requested, make no reservations */
if (__hugetlb_opts.no_reserve)
--
1.8.3.1
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/wang_yue111/libhugetlbfs.git
[email protected]:wang_yue111/libhugetlbfs.git
wang_yue111
libhugetlbfs
libhugetlbfs
master

搜索帮助