]> www.infradead.org Git - users/jedix/linux-maple.git/commit
mm: fix finish_fault() handling for large folios
authorBrian Geffon <bgeffon@google.com>
Wed, 26 Feb 2025 16:23:41 +0000 (11:23 -0500)
committerAndrew Morton <akpm@linux-foundation.org>
Fri, 28 Feb 2025 00:58:53 +0000 (16:58 -0800)
commitcc6aeaebf0b93fca96302c62a70fddde064e8fe3
treedbd2575b5668c21e7a292f1d0eca4505dc3a9dae
parent97fd90afe04ccd0a30a0c2f7980be08db1de2260
mm: fix finish_fault() handling for large folios

When handling faults for anon shmem finish_fault() will attempt to install
ptes for the entire folio.  Unfortunately if it encounters a single
non-pte_none entry in that range it will bail, even if the pte that
triggered the fault is still pte_none.  When this situation happens the
fault will be retried endlessly never making forward progress.

This patch fixes this behavior and if it detects that a pte in the range
is not pte_none it will fall back to setting a single pte.

Link: https://lkml.kernel.org/r/20250226162341.915535-1-bgeffon@google.com
Fixes: 43e027e41423 ("mm: memory: extend finish_fault() to support large folio")
Signed-off-by: Brian Geffon <bgeffon@google.com>
Suggested-by: Baolin Wang <baolin.wang@linux.alibaba.com>
Reported-by: Marek Maslanka <mmaslanka@google.com>
Cc: Hugh Dickins <hughd@google.com>
Cc: David Hildenbrand <david@redhat.com>
Cc: Hugh Dickens <hughd@google.com>
Cc: Kefeng Wang <wangkefeng.wang@huawei.com>
Cc: Matthew Wilcow (Oracle) <willy@infradead.org>
Cc: Suren Baghdasaryan <surenb@google.com>
Cc: Zi Yan <ziy@nvidia.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/memory.c