Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

mm/memory-failure: hold PTL in hwpoison_hugetlb_range

Hold PTL in hwpoison_hugetlb_range() to avoid operating on stale page, as
hwpoison_pte_range() have done.

This change is not known to address any issues which users have
experienced.

Link: https://lkml.kernel.org/r/20250725033112.2690158-1-tujinjiang@huawei.com
Signed-off-by: Jinjiang Tu <tujinjiang@huawei.com>
Acked-by: David Hildenbrand <david@redhat.com>
Cc: Andrei Vagin <avagin@gmail.com>
Cc: Andrii Nakryiko <andrii@kernel.org>
Cc: Baolin Wang <baolin.wang@linux.alibaba.com>
Cc: Brahmajit Das <brahmajit.xyz@gmail.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Christophe Leroy <christophe.leroy@csgroup.eu>
Cc: David Rientjes <rientjes@google.com>
Cc: Dev Jain <dev.jain@arm.com>
Cc: Hugh Dickins <hughd@google.com>
Cc: Joern Engel <joern@logfs.org>
Cc: Kefeng Wang <wangkefeng.wang@huawei.com>
Cc: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Ryan Roberts <ryan.roberts@arm.com>
Cc: Thiago Jung Bauermann <thiago.bauermann@linaro.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

Jinjiang Tu and committed by
Andrew Morton
9109bd52 6c2da14a

+9 -3
+9 -3
mm/memory-failure.c
··· 837 837 struct mm_walk *walk) 838 838 { 839 839 struct hwpoison_walk *hwp = walk->private; 840 - pte_t pte = huge_ptep_get(walk->mm, addr, ptep); 841 840 struct hstate *h = hstate_vma(walk->vma); 841 + spinlock_t *ptl; 842 + pte_t pte; 843 + int ret; 842 844 843 - return check_hwpoisoned_entry(pte, addr, huge_page_shift(h), 844 - hwp->pfn, &hwp->tk); 845 + ptl = huge_pte_lock(h, walk->mm, ptep); 846 + pte = huge_ptep_get(walk->mm, addr, ptep); 847 + ret = check_hwpoisoned_entry(pte, addr, huge_page_shift(h), 848 + hwp->pfn, &hwp->tk); 849 + spin_unlock(ptl); 850 + return ret; 845 851 } 846 852 #else 847 853 #define hwpoison_hugetlb_range NULL