[PATCH v1] mm/memory-failure: replace magic number 3 with GET_PAGE_MAX_RETRY_NUM

wangxuewen posted 1 patch 2 months, 1 week ago
mm/memory-failure.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH v1] mm/memory-failure: replace magic number 3 with GET_PAGE_MAX_RETRY_NUM
Posted by wangxuewen 2 months, 1 week ago
From: wangxuewen <wangxuewen@kylinos.cn>

Replace the hardcoded magic number 3 in get_any_page() with the
existing GET_PAGE_MAX_RETRY_NUM macro for code consistency and
maintainability.

This change has no functional impact, only improves code readability
and unifies the retry limit configuration.

Signed-off-by: wangxuewen <wangxuewen@kylinos.cn>
---
 mm/memory-failure.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/memory-failure.c b/mm/memory-failure.c
index ee42d4361309..e5a6b1353d9e 100644
--- a/mm/memory-failure.c
+++ b/mm/memory-failure.c
@@ -1418,7 +1418,7 @@ static int get_any_page(struct page *p, unsigned long flags)
 			 * We raced with (possibly temporary) unhandlable
 			 * page, retry.
 			 */
-			if (pass++ < 3) {
+			if (pass++ < GET_PAGE_MAX_RETRY_NUM) {
 				shake_page(p);
 				goto try_again;
 			}
-- 
2.25.1
Re: [PATCH v1] mm/memory-failure: replace magic number 3 with GET_PAGE_MAX_RETRY_NUM
Posted by Miaohe Lin 2 months, 1 week ago
On 2026/4/2 14:49, wangxuewen wrote:
> From: wangxuewen <wangxuewen@kylinos.cn>
> 
> Replace the hardcoded magic number 3 in get_any_page() with the
> existing GET_PAGE_MAX_RETRY_NUM macro for code consistency and
> maintainability.
> 
> This change has no functional impact, only improves code readability
> and unifies the retry limit configuration.
> 
> Signed-off-by: wangxuewen <wangxuewen@kylinos.cn>

Acked-by: Miaohe Lin <linmiaohe@huawei.com>

Thanks.
.

> ---
>  mm/memory-failure.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/mm/memory-failure.c b/mm/memory-failure.c
> index ee42d4361309..e5a6b1353d9e 100644
> --- a/mm/memory-failure.c
> +++ b/mm/memory-failure.c
> @@ -1418,7 +1418,7 @@ static int get_any_page(struct page *p, unsigned long flags)
>  			 * We raced with (possibly temporary) unhandlable
>  			 * page, retry.
>  			 */
> -			if (pass++ < 3) {
> +			if (pass++ < GET_PAGE_MAX_RETRY_NUM) {
>  				shake_page(p);
>  				goto try_again;
>  			}
>
Re: [PATCH v1] mm/memory-failure: replace magic number 3 with GET_PAGE_MAX_RETRY_NUM
Posted by SeongJae Park 2 months, 1 week ago
On Thu,  2 Apr 2026 14:49:46 +0800 wangxuewen <18810879172@163.com> wrote:

> From: wangxuewen <wangxuewen@kylinos.cn>
> 
> Replace the hardcoded magic number 3 in get_any_page() with the
> existing GET_PAGE_MAX_RETRY_NUM macro for code consistency and
> maintainability.
> 
> This change has no functional impact, only improves code readability
> and unifies the retry limit configuration.
> 
> Signed-off-by: wangxuewen <wangxuewen@kylinos.cn>

Acked-by: SeongJae Park <sj@kernel.org>


Thanks,
SJ

[...]