Commit fa5a061
mm/huge_memory: preserve PG_has_hwpoisoned if a folio is split to >0 order
folio split clears PG_has_hwpoisoned, but the flag should be preserved in
after-split folios containing pages with PG_hwpoisoned flag if the folio
is split to >0 order folios. Scan all pages in a to-be-split folio to
determine which after-split folios need the flag.
An alternatives is to change PG_has_hwpoisoned to PG_maybe_hwpoisoned to
avoid the scan and set it on all after-split folios, but resulting false
positive has undesirable negative impact. To remove false positive,
caller of folio_test_has_hwpoisoned() and folio_contain_hwpoisoned_page()
needs to do the scan. That might be causing a hassle for current and
future callers and more costly than doing the scan in the split code.
More details are discussed in [1].
This issue can be exposed via:
1. splitting a has_hwpoisoned folio to >0 order from debugfs interface;
2. truncating part of a has_hwpoisoned folio in
truncate_inode_partial_folio().
And later accesses to a hwpoisoned page could be possible due to the
missing has_hwpoisoned folio flag. This will lead to MCE errors.
Link: https://lore.kernel.org/all/CAHbLzkoOZm0PXxE9qwtF4gKR=cpRXrSrJ9V9Pm2DJexs985q4g@mail.gmail.com/ [1]
Link: https://lkml.kernel.org/r/20251023030521.473097-1-ziy@nvidia.com
Fixes: c010d47 ("mm: thp: split huge page to any lower order pages")
Signed-off-by: Zi Yan <ziy@nvidia.com>
Acked-by: David Hildenbrand <david@redhat.com>
Reviewed-by: Yang Shi <yang@os.amperecomputing.com>
Reviewed-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Reviewed-by: Lance Yang <lance.yang@linux.dev>
Reviewed-by: Miaohe Lin <linmiaohe@huawei.com>
Reviewed-by: Baolin Wang <baolin.wang@linux.alibaba.com>
Reviewed-by: Wei Yang <richard.weiyang@gmail.com>
Cc: Pankaj Raghav <kernel@pankajraghav.com>
Cc: Barry Song <baohua@kernel.org>
Cc: Dev Jain <dev.jain@arm.com>
Cc: Jane Chu <jane.chu@oracle.com>
Cc: Liam Howlett <liam.howlett@oracle.com>
Cc: Luis Chamberalin <mcgrof@kernel.org>
Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
Cc: Naoya Horiguchi <nao.horiguchi@gmail.com>
Cc: Nico Pache <npache@redhat.com>
Cc: Ryan Roberts <ryan.roberts@arm.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>1 parent f5548c3 commit fa5a061
1 file changed
+20
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3263 | 3263 | | |
3264 | 3264 | | |
3265 | 3265 | | |
| 3266 | + | |
| 3267 | + | |
| 3268 | + | |
| 3269 | + | |
| 3270 | + | |
| 3271 | + | |
| 3272 | + | |
| 3273 | + | |
3266 | 3274 | | |
3267 | 3275 | | |
3268 | 3276 | | |
3269 | 3277 | | |
3270 | 3278 | | |
3271 | 3279 | | |
3272 | 3280 | | |
| 3281 | + | |
| 3282 | + | |
3273 | 3283 | | |
3274 | 3284 | | |
3275 | 3285 | | |
3276 | 3286 | | |
| 3287 | + | |
| 3288 | + | |
| 3289 | + | |
| 3290 | + | |
| 3291 | + | |
| 3292 | + | |
3277 | 3293 | | |
3278 | 3294 | | |
3279 | 3295 | | |
3280 | 3296 | | |
3281 | 3297 | | |
3282 | 3298 | | |
3283 | | - | |
3284 | 3299 | | |
3285 | 3300 | | |
3286 | 3301 | | |
| |||
3322 | 3337 | | |
3323 | 3338 | | |
3324 | 3339 | | |
| 3340 | + | |
| 3341 | + | |
| 3342 | + | |
| 3343 | + | |
3325 | 3344 | | |
3326 | 3345 | | |
3327 | 3346 | | |
| |||
3422 | 3441 | | |
3423 | 3442 | | |
3424 | 3443 | | |
3425 | | - | |
3426 | | - | |
3427 | 3444 | | |
3428 | 3445 | | |
3429 | 3446 | | |
| |||
0 commit comments