Re: [PATCH -v5 1/2] mm: add spurious fault fixing support for huge pmd

From: Zi Yan

Date: Wed Nov 12 2025 - 10:53:44 EST


On 11 Nov 2025, at 20:38, Huang Ying wrote:

> The page faults may be spurious because of the racy access to the page
> table. For example, a non-populated virtual page is accessed on 2
> CPUs simultaneously, thus the page faults are triggered on both CPUs.
> However, it's possible that one CPU (say CPU A) cannot find the reason
> for the page fault if the other CPU (say CPU B) has changed the page
> table before the PTE is checked on CPU A. Most of the time, the
> spurious page faults can be ignored safely. However, if the page
> fault is for the write access, it's possible that a stale read-only
> TLB entry exists in the local CPU and needs to be flushed on some
> architectures. This is called the spurious page fault fixing.
>
> In the current kernel, there is spurious fault fixing support for pte,
> but not for huge pmd because no architectures need it. But in the
> next patch in the series, we will change the write protection fault
> handling logic on arm64, so that some stale huge pmd entries may
> remain in the TLB. These entries need to be flushed via the huge pmd
> spurious fault fixing mechanism.
>
> Signed-off-by: Huang Ying <ying.huang@xxxxxxxxxxxxxxxxx>
> Reviewed-by: Lorenzo Stoakes <lorenzo.stoakes@xxxxxxxxxx>
> Acked-by: David Hildenbrand <david@xxxxxxxxxx>
> Cc: Catalin Marinas <catalin.marinas@xxxxxxx>
> Cc: Will Deacon <will@xxxxxxxxxx>
> Cc: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
> Cc: Vlastimil Babka <vbabka@xxxxxxx>
> Cc: Zi Yan <ziy@xxxxxxxxxx>
> Cc: Baolin Wang <baolin.wang@xxxxxxxxxxxxxxxxx>
> Cc: Ryan Roberts <ryan.roberts@xxxxxxx>
> Cc: Yang Shi <yang@xxxxxxxxxxxxxxxxxxxxxx>
> Cc: "Christoph Lameter (Ampere)" <cl@xxxxxxxxxx>
> Cc: Dev Jain <dev.jain@xxxxxxx>
> Cc: Barry Song <baohua@xxxxxxxxxx>
> Cc: Anshuman Khandual <anshuman.khandual@xxxxxxx>
> Cc: Kefeng Wang <wangkefeng.wang@xxxxxxxxxx>
> Cc: Kevin Brodsky <kevin.brodsky@xxxxxxx>
> Cc: Yin Fengwei <fengwei_yin@xxxxxxxxxxxxxxxxx>
> Cc: linux-arm-kernel@xxxxxxxxxxxxxxxxxxx
> Cc: linux-kernel@xxxxxxxxxxxxxxx
> Cc: linux-mm@xxxxxxxxx
> ---
> include/linux/huge_mm.h | 2 +-
> include/linux/pgtable.h | 4 +++
> mm/huge_memory.c | 33 ++++++++++++++--------
> mm/internal.h | 2 +-
> mm/memory.c | 62 ++++++++++++++++++++++++++++++-----------
> 5 files changed, 73 insertions(+), 30 deletions(-)
>
LGTM. Acked-by: Zi Yan <ziy@xxxxxxxxxx>

Best Regards,
Yan, Zi