diff options
| author | Jane Chu <[email protected]> | 2024-05-24 15:53:05 -0600 |
|---|---|---|
| committer | Andrew Morton <[email protected]> | 2024-07-03 19:29:58 -0700 |
| commit | 9b0ab153d76972a3bee4f363058ff06edf9255a3 (patch) | |
| tree | 578bd5e74ed43d10a03a81999ee98cf6ee19e52f | |
| parent | b8b9488d50b7150bd4830dfff487e8d4ef6589ba (diff) | |
mm/memory-failure: move hwpoison_filter() higher up
Move hwpoison_filter() higher up as there is no need to spend a lot cycles
only to find out later that the page is supposed to be skipped from
hwpoison handling.
Link: https://lkml.kernel.org/r/[email protected]
Signed-off-by: Jane Chu <[email protected]>
Reviewed-by: Oscar Salvador <[email protected]>
Acked-by: Miaohe Lin <[email protected]>
Cc: Naoya Horiguchi <[email protected]>
Cc: Oscar Salvador <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
| -rw-r--r-- | mm/memory-failure.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/mm/memory-failure.c b/mm/memory-failure.c index 7f29f1adba21..7e568838fb32 100644 --- a/mm/memory-failure.c +++ b/mm/memory-failure.c @@ -2300,6 +2300,18 @@ try_again: } folio = page_folio(p); + + /* filter pages that are protected from hwpoison test by users */ + folio_lock(folio); + if (hwpoison_filter(p)) { + ClearPageHWPoison(p); + folio_unlock(folio); + folio_put(folio); + res = -EOPNOTSUPP; + goto unlock_mutex; + } + folio_unlock(folio); + if (folio_test_large(folio)) { /* * The flag must be set after the refcount is bumped @@ -2363,14 +2375,6 @@ try_again: */ page_flags = folio->flags; - if (hwpoison_filter(p)) { - ClearPageHWPoison(p); - folio_unlock(folio); - folio_put(folio); - res = -EOPNOTSUPP; - goto unlock_mutex; - } - /* * __munlock_folio() may clear a writeback folio's LRU flag without * the folio lock. We need to wait for writeback completion for this |