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

Zi Yan ziy at nvidia.com
Wed Nov 12 07:53:21 PST 2025


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 at linux.alibaba.com>
> Reviewed-by: Lorenzo Stoakes <lorenzo.stoakes at oracle.com>
> Acked-by: David Hildenbrand <david at redhat.com>
> Cc: Catalin Marinas <catalin.marinas at arm.com>
> Cc: Will Deacon <will at kernel.org>
> Cc: Andrew Morton <akpm at linux-foundation.org>
> Cc: Vlastimil Babka <vbabka at suse.cz>
> Cc: Zi Yan <ziy at nvidia.com>
> Cc: Baolin Wang <baolin.wang at linux.alibaba.com>
> Cc: Ryan Roberts <ryan.roberts at arm.com>
> Cc: Yang Shi <yang at os.amperecomputing.com>
> Cc: "Christoph Lameter (Ampere)" <cl at gentwo.org>
> Cc: Dev Jain <dev.jain at arm.com>
> Cc: Barry Song <baohua at kernel.org>
> Cc: Anshuman Khandual <anshuman.khandual at arm.com>
> Cc: Kefeng Wang <wangkefeng.wang at huawei.com>
> Cc: Kevin Brodsky <kevin.brodsky at arm.com>
> Cc: Yin Fengwei <fengwei_yin at linux.alibaba.com>
> Cc: linux-arm-kernel at lists.infradead.org
> Cc: linux-kernel at vger.kernel.org
> Cc: linux-mm at kvack.org
> ---
>  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 at nvidia.com>

Best Regards,
Yan, Zi



More information about the linux-arm-kernel mailing list