diff mbox series

mm/page_alloc: Replace flag check with PageHWPoison() in check_new_page_bad()

Message ID 20250320063346.489030-1-ye.liu@linux.dev (mailing list archive)
State New
Headers show
Series mm/page_alloc: Replace flag check with PageHWPoison() in check_new_page_bad() | expand

Commit Message

Ye Liu March 20, 2025, 6:33 a.m. UTC
From: Ye Liu <liuye@kylinos.cn>

This patch replaces the direct check for the __PG_HWPOISON flag with
the PageHWPoison() macro, improving code readability and maintaining
consistency with other parts of the memory management code.

Signed-off-by: Ye Liu <liuye@kylinos.cn>
---
 mm/page_alloc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Sidhartha Kumar March 20, 2025, 3:41 p.m. UTC | #1
On 3/20/25 2:33 AM, Ye Liu wrote:
> From: Ye Liu <liuye@kylinos.cn>
> 
> This patch replaces the direct check for the __PG_HWPOISON flag with
> the PageHWPoison() macro, improving code readability and maintaining
> consistency with other parts of the memory management code.
> 
> Signed-off-by: Ye Liu <liuye@kylinos.cn>
> ---
>   mm/page_alloc.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> index fe76fd237dd0..6ef54abebf51 100644
> --- a/mm/page_alloc.c
> +++ b/mm/page_alloc.c
> @@ -1427,7 +1427,7 @@ static __always_inline void page_del_and_expand(struct zone *zone,
>   
>   static void check_new_page_bad(struct page *page)
>   {
> -	if (unlikely(page->flags & __PG_HWPOISON)) {
> +	if (unlikely(PageHWPoison(page))) {
>   		/* Don't complain about hwpoisoned pages */
>   		if (PageBuddy(page))
>   			__ClearPageBuddy(page);

Reviewed-by: Sidhartha Kumar <sidhartha.kumar@oracle.com>
Anshuman Khandual March 21, 2025, 4:48 a.m. UTC | #2
On 3/20/25 12:03, Ye Liu wrote:
> From: Ye Liu <liuye@kylinos.cn>
> 
> This patch replaces the direct check for the __PG_HWPOISON flag with
> the PageHWPoison() macro, improving code readability and maintaining
> consistency with other parts of the memory management code.
> 
> Signed-off-by: Ye Liu <liuye@kylinos.cn>
> ---
>  mm/page_alloc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> index fe76fd237dd0..6ef54abebf51 100644
> --- a/mm/page_alloc.c
> +++ b/mm/page_alloc.c
> @@ -1427,7 +1427,7 @@ static __always_inline void page_del_and_expand(struct zone *zone,
>  
>  static void check_new_page_bad(struct page *page)
>  {
> -	if (unlikely(page->flags & __PG_HWPOISON)) {
> +	if (unlikely(PageHWPoison(page))) {
>  		/* Don't complain about hwpoisoned pages */
>  		if (PageBuddy(page))
>  			__ClearPageBuddy(page);

Reviewed-by: Anshuman Khandual <anshuman.khandual@arm.com>
diff mbox series

Patch

diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index fe76fd237dd0..6ef54abebf51 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -1427,7 +1427,7 @@  static __always_inline void page_del_and_expand(struct zone *zone,
 
 static void check_new_page_bad(struct page *page)
 {
-	if (unlikely(page->flags & __PG_HWPOISON)) {
+	if (unlikely(PageHWPoison(page))) {
 		/* Don't complain about hwpoisoned pages */
 		if (PageBuddy(page))
 			__ClearPageBuddy(page);