Commit 34b82f3
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.
[bgeffon@google.com: tweak whitespace]
Link: https://lkml.kernel.org/r/20250227133236.1296853-1-bgeffon@google.com
Link: https://lkml.kernel.org/r/20250226162341.915535-1-bgeffon@google.com
Fixes: 43e027e ("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>1 parent 3685024 commit 34b82f3
1 file changed
Lines changed: 10 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5185 | 5185 | | |
5186 | 5186 | | |
5187 | 5187 | | |
5188 | | - | |
| 5188 | + | |
| 5189 | + | |
| 5190 | + | |
| 5191 | + | |
| 5192 | + | |
5189 | 5193 | | |
5190 | 5194 | | |
5191 | 5195 | | |
| |||
5224 | 5228 | | |
5225 | 5229 | | |
5226 | 5230 | | |
5227 | | - | |
| 5231 | + | |
| 5232 | + | |
5228 | 5233 | | |
5229 | 5234 | | |
5230 | 5235 | | |
| |||
5260 | 5265 | | |
5261 | 5266 | | |
5262 | 5267 | | |
5263 | | - | |
5264 | | - | |
5265 | | - | |
| 5268 | + | |
| 5269 | + | |
| 5270 | + | |
5266 | 5271 | | |
5267 | 5272 | | |
5268 | 5273 | | |
| |||
0 commit comments