提交 0ab3b159 编写于 作者: G Guo Mengqi 提交者: Zheng Zengkai

sharepool: fix hisi oom deadlock

hulk inclusion
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I54I59
CVE: NA
backport: openEuler-22.03-LTS

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

When hisi_oom_notifier_call calls spg_overview_show, it requires the
global rwsem sp_group_sem, which had been held by another process when oomed.
This leads to kernel hungtask. At another position the unecessary sp_group_sem
causes an ABBA deadlock.

    [ 1934.549016] INFO: task klogd:2757 blocked for more than 120 seconds.
    [ 1934.562408] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
    [ 1934.570231] klogd           D    0  2757   2746 0x00000000
    [ 1934.575707] Call trace:
    [ 1934.578162]  __switch_to+0xe8/0x150
    [ 1934.581648]  __schedule+0x250/0x558
    [ 1934.585133]  schedule+0x30/0xf0
    [ 1934.588267]  rwsem_down_read_failed+0x10c/0x188
    [ 1934.592788]  down_read+0x60/0x68
    [ 1934.596015]  spg_overview_show.part.31+0xc8/0xf8
    [ 1934.600622]  spg_overview_show+0x2c/0x38
    [ 1934.604543]  hisi_oom_notifier_call+0xe8/0x120
    [ 1934.608975]  out_of_memory+0x7c/0x570
    [ 1934.612631]  __alloc_pages_nodemask+0xcfc/0xd98
    [ 1934.617158]  alloc_pages_current+0x88/0xf0
    [ 1934.621246]  __page_cache_alloc+0x8c/0xd8
    [ 1934.625247]  page_cache_alloc_inode+0x48/0x58
    [ 1934.629595]  filemap_fault+0x360/0x8e0
    [ 1934.633341]  ext4_filemap_fault+0x38/0x128
    [ 1934.637431]  __do_fault+0x50/0x218
    [ 1934.640822]  __handle_mm_fault+0x69c/0x9c8
    [ 1934.644909]  handle_mm_fault+0xf8/0x200
    [ 1934.648740]  do_page_fault+0x220/0x508
    [ 1934.652477]  do_translation_fault+0xa8/0xbc
    [ 1934.656652]  do_mem_abort+0x68/0x118
    [ 1934.660216]  do_el0_ia_bp_hardening+0x6c/0xd8
    [ 1934.664565]  el0_ia+0x20/0x24
Signed-off-by: NGuo Mengqi <guomengqi3@huawei.com>
Reviewed-by: NWeilong Chen <chenweilong@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 faecf31f
......@@ -4042,9 +4042,9 @@ void spg_overview_show(struct seq_file *seq)
atomic_read(&sp_overall_stat.spa_total_num));
}
down_read(&sp_group_sem);
down_read(&sp_spg_stat_sem);
idr_for_each(&sp_spg_stat_idr, idr_spg_stat_cb, seq);
up_read(&sp_group_sem);
up_read(&sp_spg_stat_sem);
if (seq != NULL)
seq_puts(seq, "\n");
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册