mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-01-04 04:04:19 +00:00
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/20240524215306.2705454-5-jane.chu@oracle.com Signed-off-by: Jane Chu <jane.chu@oracle.com> Reviewed-by: Oscar Salvador <osalvador@suse.de> Acked-by: Miaohe Lin <linmiaohe@huawei.com> Cc: Naoya Horiguchi <nao.horiguchi@gmail.com> Cc: Oscar Salvador <oalvador@suse.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
This commit is contained in:
parent
b8b9488d50
commit
9b0ab153d7
@ -2300,6 +2300,18 @@ int memory_failure(unsigned long pfn, int flags)
|
||||
}
|
||||
|
||||
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 @@ int memory_failure(unsigned long pfn, int flags)
|
||||
*/
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user