提交 5b40e9d1 编写于 作者: T Tang Yizhou 提交者: Yang Yingliang

share_pool: Print info when thread is being killed

ascend inclusion
category: feature
bugzilla: https://gitee.com/openeuler/kernel/issues/I4EUVI
CVE: NA

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

We find there are two differnt errnos returned when do_mm_polulate is
called and current thread is being killed, which may confuse logger
readers.

1. do_mm_populate -> populate_vma_page_range -> __get_user_pages.
if fatal_signal_pending fails, return -ERESTARTSYS(-512).
2. __get_user_pages -> follow_hugetlb_page.
if fatal_signal_pending fails, return -EFAULT(-14).

So we call fatal_signal_pending after do_mm_populte fails in share pool
and give info about the thread killing event.
Signed-off-by: NTang Yizhou <tangyizhou@huawei.com>
Reviewed-by: NDing Tianhong <dingtianhong@huawei.com>
Reviewed-by: NKefeng  Wang <wangkefeng.wang@huawei.com>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
Reviewed-by: NWeilong Chen <chenweilong@huawei.com>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 c9034750
......@@ -718,8 +718,11 @@ int sp_group_add_task(int pid, int spg_id)
if (populate) {
ret = do_mm_populate(mm, spa->va_start, populate, 0);
if (ret) {
pr_warn_ratelimited("share pool: task add group failed, mm populate failed "
"(potential no enough memory when -12): %d, spa type is %d\n",
if (unlikely(fatal_signal_pending(current)))
pr_warn_ratelimited("share pool: task add group failed, current thread is killed\n");
else
pr_warn_ratelimited("share pool: task add group failed, mm populate failed "
"(potential no enough memory when -12): %d, spa type is %d\n",
ret, spa->type);
down_write(&mm->mmap_sem);
sp_munmap_task_areas(mm, spa->link.next);
......@@ -1427,10 +1430,12 @@ void *sp_alloc(unsigned long size, unsigned long sp_flags, int spg_id)
sp_add_work_compact();
}
if (ret) {
__sp_free(spg, sp_addr, size_aligned,
list_next_entry(mm, sp_node));
pr_warn_ratelimited("share pool: allocation failed due to mm populate failed"
"(potential no enough memory when -12): %d\n", ret);
__sp_free(spg, sp_addr, size_aligned, list_next_entry(mm, sp_node));
if (unlikely(fatal_signal_pending(current)))
pr_warn_ratelimited("share pool: allocation failed, current thread is killed\n");
else
pr_warn_ratelimited("share pool: allocation failed due to mm populate failed"
"(potential no enough memory when -12): %d\n", ret);
p = ERR_PTR(ret);
mode = FALLOC_FL_KEEP_SIZE | FALLOC_FL_PUNCH_HOLE;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册