The patch titled Subject: mm/memory-failure: add macro GET_PAGE_MAX_RETRY_NUM has been added to the -mm mm-unstable branch. Its filename is mm-memory-failure-add-macro-get_page_max_retry_num.patch This patch will shortly appear at https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-memory-failure-add-macro-get_page_max_retry_num.patch This patch will later appear in the mm-unstable branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next via the mm-everything branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm and is updated there every 2-3 working days ------------------------------------------------------ From: Miaohe Lin <linmiaohe@xxxxxxxxxx> Subject: mm/memory-failure: add macro GET_PAGE_MAX_RETRY_NUM Date: Wed, 12 Jun 2024 15:18:25 +0800 Add helper macro GET_PAGE_MAX_RETRY_NUM to replace magic number 3. No functional change intended. Link: https://lkml.kernel.org/r/20240612071835.157004-4-linmiaohe@xxxxxxxxxx Signed-off-by: Miaohe Lin <linmiaohe@xxxxxxxxxx> Cc: Borislav Petkov (AMD) <bp@xxxxxxxxx> Cc: David Hildenbrand <david@xxxxxxxxxx> Cc: kernel test robot <lkp@xxxxxxxxx> Cc: Naoya Horiguchi <nao.horiguchi@xxxxxxxxx> Cc: Tony Luck <tony.luck@xxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/memory-failure.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) --- a/mm/memory-failure.c~mm-memory-failure-add-macro-get_page_max_retry_num +++ a/mm/memory-failure.c @@ -1417,6 +1417,8 @@ static int __get_hwpoison_page(struct pa return 0; } +#define GET_PAGE_MAX_RETRY_NUM 3 + static int get_any_page(struct page *p, unsigned long flags) { int ret = 0, pass = 0; @@ -1431,12 +1433,12 @@ try_again: if (!ret) { if (page_count(p)) { /* We raced with an allocation, retry. */ - if (pass++ < 3) + if (pass++ < GET_PAGE_MAX_RETRY_NUM) goto try_again; ret = -EBUSY; } else if (!PageHuge(p) && !is_free_buddy_page(p)) { /* We raced with put_page, retry. */ - if (pass++ < 3) + if (pass++ < GET_PAGE_MAX_RETRY_NUM) goto try_again; ret = -EIO; } @@ -1462,7 +1464,7 @@ try_again: * A page we cannot handle. Check whether we can turn * it into something we can handle. */ - if (pass++ < 3) { + if (pass++ < GET_PAGE_MAX_RETRY_NUM) { put_page(p); shake_page(p); count_increased = false; _ Patches currently in -mm which might be from linmiaohe@xxxxxxxxxx are mm-memory-failure-simplify-put_ref_page.patch mm-memory-failure-remove-mf_msg_slab.patch mm-memory-failure-add-macro-get_page_max_retry_num.patch mm-memory-failure-save-some-page_folio-calls.patch mm-memory-failure-remove-unneeded-empty-string.patch mm-memory-failure-remove-confusing-initialization-to-count.patch mm-memory-failure-dont-export-hwpoison_filter-when-config_hwpoison_inject.patch mm-memory-failure-use-helper-macro-task_pid_nr.patch mm-memory-failure-remove-obsolete-comment-in-unpoison_memory.patch mm-memory-failure-move-some-function-declarations-into-internalh.patch mm-memory-failure-fix-comment-of-get_hwpoison_page.patch mm-memory-failure-remove-obsolete-comment-in-kill_proc.patch mm-memory-failure-correct-comment-in-me_swapcache_dirty.patch