未验证 提交 6eb5c28e 编写于 作者: O openharmony_ci 提交者: Gitee

!1004 Modify memory tag

Merge pull request !1004 from yinchuang/prctl_tag
...@@ -126,7 +126,7 @@ struct meta *alloc_meta(void) ...@@ -126,7 +126,7 @@ struct meta *alloc_meta(void)
if (brk(new) != new) { if (brk(new) != new) {
ctx.brk = -1; ctx.brk = -1;
} else { } else {
prctl(PR_SET_VMA, PR_SET_VMA_ANON_NAME, ctx.brk, new - ctx.brk, "heap:meta"); prctl(PR_SET_VMA, PR_SET_VMA_ANON_NAME, ctx.brk, new - ctx.brk, "native_heap:meta");
if (need_guard) mmap((void *)ctx.brk, pagesize, if (need_guard) mmap((void *)ctx.brk, pagesize,
PROT_NONE, MAP_ANON|MAP_PRIVATE|MAP_FIXED, -1, 0); PROT_NONE, MAP_ANON|MAP_PRIVATE|MAP_FIXED, -1, 0);
ctx.brk = new; ctx.brk = new;
...@@ -315,7 +315,7 @@ static struct meta *alloc_group(int sc, size_t req) ...@@ -315,7 +315,7 @@ static struct meta *alloc_group(int sc, size_t req)
free_meta(m); free_meta(m);
return 0; return 0;
} }
prctl(PR_SET_VMA, PR_SET_VMA_ANON_NAME, p, needed, "heap:brk"); prctl(PR_SET_VMA, PR_SET_VMA_ANON_NAME, p, needed, "native_heap:brk");
m->maplen = needed>>12; m->maplen = needed>>12;
ctx.mmap_counter++; ctx.mmap_counter++;
active_idx = (4096-UNIT)/size-1; active_idx = (4096-UNIT)/size-1;
...@@ -376,7 +376,7 @@ void *malloc(size_t n) ...@@ -376,7 +376,7 @@ void *malloc(size_t n)
MAP_PRIVATE|MAP_ANON, -1, 0); MAP_PRIVATE|MAP_ANON, -1, 0);
if (p==MAP_FAILED) return 0; if (p==MAP_FAILED) return 0;
wrlock(); wrlock();
prctl(PR_SET_VMA, PR_SET_VMA_ANON_NAME, p, needed, "heap:mmap"); prctl(PR_SET_VMA, PR_SET_VMA_ANON_NAME, p, needed, "native_heap:mmap");
step_seq(); step_seq();
g = alloc_meta(); g = alloc_meta();
if (!g) { if (!g) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册