提交 357670f7 编写于 作者: M Miaohe Lin 提交者: Linus Torvalds

mm/memory-failure.c: rework the try_to_unmap logic in hwpoison_user_mappings()

Only for hugetlb pages in shared mappings, try_to_unmap should take
semaphore in write mode here.  Rework the code to make it clear.

Link: https://lkml.kernel.org/r/20220218090118.1105-7-linmiaohe@huawei.comSigned-off-by: NMiaohe Lin <linmiaohe@huawei.com>
Acked-by: NNaoya Horiguchi <naoya.horiguchi@nec.com>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 67ff51c6
...@@ -1404,10 +1404,7 @@ static bool hwpoison_user_mappings(struct page *p, unsigned long pfn, ...@@ -1404,10 +1404,7 @@ static bool hwpoison_user_mappings(struct page *p, unsigned long pfn,
if (kill) if (kill)
collect_procs(hpage, &tokill, flags & MF_ACTION_REQUIRED); collect_procs(hpage, &tokill, flags & MF_ACTION_REQUIRED);
if (!PageHuge(hpage)) { if (PageHuge(hpage) && !PageAnon(hpage)) {
try_to_unmap(hpage, ttu);
} else {
if (!PageAnon(hpage)) {
/* /*
* For hugetlb pages in shared mappings, try_to_unmap * For hugetlb pages in shared mappings, try_to_unmap
* could potentially call huge_pmd_unshare. Because of * could potentially call huge_pmd_unshare. Because of
...@@ -1424,7 +1421,6 @@ static bool hwpoison_user_mappings(struct page *p, unsigned long pfn, ...@@ -1424,7 +1421,6 @@ static bool hwpoison_user_mappings(struct page *p, unsigned long pfn,
} else { } else {
try_to_unmap(hpage, ttu); try_to_unmap(hpage, ttu);
} }
}
unmap_success = !page_mapped(hpage); unmap_success = !page_mapped(hpage);
if (!unmap_success) if (!unmap_success)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册