1 Star 0 Fork 22

wang_yue111/libhugetlbfs

forked from src-openEuler/libhugetlbfs 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
libhugetlbfs-2.16-remap_segments_with_MAP_SHARED-2.patch 1.61 KB
一键复制 编辑 原始数据 按行查看 历史
hexiaowen 提交于 2019-09-30 10:56 . Package init
diff -Naur libhugetlbfs-2.16/elflink.c libhugetlbfs-2.16.new//elflink.c
--- libhugetlbfs-2.16/elflink.c 2017-11-09 20:30:38.000000000 -0500
+++ libhugetlbfs-2.16.new//elflink.c 2017-11-09 22:36:56.000000000 -0500
@@ -1131,7 +1131,10 @@
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_SHARED|MAP_FIXED;
+ if(__hugetlb_opts.share_mapping)
+ mmap_flags = MAP_SHARED|MAP_FIXED;
+ else
+ mmap_flags = MAP_PRIVATE|MAP_FIXED;
/* If requested, make no reservations */
if (__hugetlb_opts.no_reserve)
diff -Naur libhugetlbfs-2.16/hugeutils.c libhugetlbfs-2.16.new//hugeutils.c
--- libhugetlbfs-2.16/hugeutils.c 2013-03-09 21:59:52.000000000 -0500
+++ libhugetlbfs-2.16.new//hugeutils.c 2017-11-09 22:36:45.000000000 -0500
@@ -387,6 +387,12 @@
env = getenv("HUGETLB_NO_RESERVE");
if (env && !strcasecmp(env, "yes"))
__hugetlb_opts.no_reserve = true;
+
+ /* Determine if data segment share memory mapping */
+ __hugetlb_opts.share_mapping = false;
+ env = getenv("HUGETLB_SHAREMAPPING");
+ if (env && !strcasecmp(env, "yes"))
+ __hugetlb_opts.share_mapping = true;
}
void hugetlbfs_setup_kernel_page_size()
diff -Naur libhugetlbfs-2.16/libhugetlbfs_internal.h libhugetlbfs-2.16.new//libhugetlbfs_internal.h
--- libhugetlbfs-2.16/libhugetlbfs_internal.h 2013-03-09 21:59:52.000000000 -0500
+++ libhugetlbfs-2.16.new//libhugetlbfs_internal.h 2017-11-09 22:35:53.000000000 -0500
@@ -73,6 +73,7 @@
char *def_page_size;
char *morecore;
char *heapbase;
+ bool share_mapping;
};
/*
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/wang_yue111/libhugetlbfs.git
[email protected]:wang_yue111/libhugetlbfs.git
wang_yue111
libhugetlbfs
libhugetlbfs
master

搜索帮助