提交 1343dd93 编写于 作者: W Wang Wensheng

mm/sharepool: Rebind the numa node when fallback to normal pages

hulk inclusion
category: feature
bugzilla: https://gitee.com/openeuler/kernel/issues/I5XQS4
CVE: NA

--------------------------------

When we allocate memory using SP_HUGEPAGE, we would try normal pages when
there was no enough hugepages. The specified numa node information would
get lost when we fallback to normal pages. The result is that we could
allocate memory from other numa node than what we have specified.

The soultion is to rebind the node before retrying.
Signed-off-by: NWang Wensheng <wangwensheng4@huawei.com>
上级 95618625
......@@ -2622,8 +2622,15 @@ void *mg_sp_alloc(unsigned long size, unsigned long sp_flags, int spg_id)
}
ret = sp_alloc_mmap_populate(spa, &ac);
if (ret && ac.state == ALLOC_RETRY)
if (ret && ac.state == ALLOC_RETRY) {
/*
* The mempolicy for shared memory is located at backend file, which varies
* between normal pages and huge pages. So we should set the mbind policy again
* when we retry using normal pages.
*/
ac.have_mbind = false;
goto try_again;
}
out:
sp_alloc_finish(ret, spa, &ac);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册