Commit 90253ac
mm/huge_memory: preserve PG_has_hwpoisoned if a folio is split to >0 order
commit fa5a061 upstream.
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/[email protected]
Fixes: c010d47 ("mm: thp: split huge page to any lower order pages")
Signed-off-by: Zi Yan <[email protected]>
Acked-by: David Hildenbrand <[email protected]>
Reviewed-by: Yang Shi <[email protected]>
Reviewed-by: Lorenzo Stoakes <[email protected]>
Reviewed-by: Lance Yang <[email protected]>
Reviewed-by: Miaohe Lin <[email protected]>
Reviewed-by: Baolin Wang <[email protected]>
Reviewed-by: Wei Yang <[email protected]>
Cc: Pankaj Raghav <[email protected]>
Cc: Barry Song <[email protected]>
Cc: Dev Jain <[email protected]>
Cc: Jane Chu <[email protected]>
Cc: Liam Howlett <[email protected]>
Cc: Luis Chamberalin <[email protected]>
Cc: Matthew Wilcox (Oracle) <[email protected]>
Cc: Naoya Horiguchi <[email protected]>
Cc: Nico Pache <[email protected]>
Cc: Ryan Roberts <[email protected]>
Cc: <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>1 parent 6393d21 commit 90253ac
1 file changed
+23
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3091 | 3091 | | |
3092 | 3092 | | |
3093 | 3093 | | |
| 3094 | + | |
| 3095 | + | |
| 3096 | + | |
| 3097 | + | |
| 3098 | + | |
| 3099 | + | |
| 3100 | + | |
| 3101 | + | |
3094 | 3102 | | |
3095 | 3103 | | |
3096 | | - | |
| 3104 | + | |
3097 | 3105 | | |
3098 | 3106 | | |
3099 | 3107 | | |
| |||
3170 | 3178 | | |
3171 | 3179 | | |
3172 | 3180 | | |
| 3181 | + | |
| 3182 | + | |
| 3183 | + | |
| 3184 | + | |
| 3185 | + | |
3173 | 3186 | | |
3174 | 3187 | | |
3175 | 3188 | | |
| |||
3194 | 3207 | | |
3195 | 3208 | | |
3196 | 3209 | | |
| 3210 | + | |
| 3211 | + | |
3197 | 3212 | | |
3198 | 3213 | | |
3199 | 3214 | | |
| |||
3217 | 3232 | | |
3218 | 3233 | | |
3219 | 3234 | | |
| 3235 | + | |
| 3236 | + | |
| 3237 | + | |
| 3238 | + | |
| 3239 | + | |
3220 | 3240 | | |
3221 | | - | |
| 3241 | + | |
| 3242 | + | |
3222 | 3243 | | |
3223 | 3244 | | |
3224 | 3245 | | |
| |||
0 commit comments