Re: [PATCH v7 02/13] mm: Rename folio_contain_hwpoison_page() to folio_has_hwpoison_page()

[email protected] Thu, 30 Jul 2026 23:07:49 -0700
Newsgroups org.kernel.vger.linux-fsdevel,org.kvack.linux-mm
Message-ID <[email protected]>

On 7/28/2026 1:43 PM, Matthew Wilcox (Oracle) wrote:
> This is a better name for this predicate. Also make the argument const 
> to allow other callers to be made const. No functional change. Signed- 
> off-by: Matthew Wilcox (Oracle) <willy@ infradead. org> Acked-by: Usama 
> Arif <usama. arif@ linux. dev>
> 
> 
> This is a better name for this predicate.  Also make the argument const
> to allow other callers to be made const.  No functional change.
> 
> Signed-off-by: Matthew Wilcox (Oracle) <[email protected]>
> Acked-by: Usama Arif <[email protected]>
> Reviewed-by: Gregory Price <[email protected]>
> ---
>   include/linux/page-flags.h | 4 ++--
>   mm/huge_memory.c           | 2 +-
>   mm/memory_hotplug.c        | 2 +-
>   mm/shmem.c                 | 2 +-
>   mm/vmscan.c                | 2 +-
>   5 files changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
> index 7223f6f4e2b4..4185a03a45cf 100644
> --- a/include/linux/page-flags.h
> +++ b/include/linux/page-flags.h
> @@ -1083,10 +1083,10 @@ static inline bool is_page_hwpoison(const struct page *page)
>   	return folio_test_hugetlb(folio) && PageHWPoison(&folio->page);
>   }
>   
> -static inline bool folio_contain_hwpoisoned_page(struct folio *folio)
> +static inline bool folio_has_hwpoisoned_page(const struct folio *folio)
>   {
>   	return folio_test_hwpoison(folio) ||
> -	    (folio_test_large(folio) && folio_test_has_hwpoisoned(folio));
> +	       (folio_test_large(folio) && folio_test_has_hwpoisoned(folio));
>   }
>   
>   bool is_free_buddy_page(const struct page *page);
> diff --git a/mm/huge_memory.c b/mm/huge_memory.c
> index 2bccb0a53a0a..353340309107 100644
> --- a/mm/huge_memory.c
> +++ b/mm/huge_memory.c
> @@ -4413,7 +4413,7 @@ static bool thp_underused(struct folio *folio)
>   	if (khugepaged_max_ptes_none == HPAGE_PMD_NR - 1)
>   		return false;
>   
> -	if (folio_contain_hwpoisoned_page(folio))
> +	if (folio_has_hwpoisoned_page(folio))
>   		return false;
>   
>   	for (i = 0; i < folio_nr_pages(folio); i++) {
> diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
> index 7ac19fab2263..33007e8e546a 100644
> --- a/mm/memory_hotplug.c
> +++ b/mm/memory_hotplug.c
> @@ -1813,7 +1813,7 @@ static void do_migrate_range(unsigned long start_pfn, unsigned long end_pfn)
>   		if (folio_test_large(folio))
>   			pfn = folio_pfn(folio) + folio_nr_pages(folio) - 1;
>   
> -		if (folio_contain_hwpoisoned_page(folio)) {
> +		if (folio_has_hwpoisoned_page(folio)) {
>   			/*
>   			 * unmap_poisoned_folio() cannot handle large folios
>   			 * in all cases yet.
> diff --git a/mm/shmem.c b/mm/shmem.c
> index b51f83c970bb..492c9bef3620 100644
> --- a/mm/shmem.c
> +++ b/mm/shmem.c
> @@ -3240,7 +3240,7 @@ shmem_write_begin(const struct kiocb *iocb, struct address_space *mapping,
>   	if (ret)
>   		return ret;
>   
> -	if (folio_contain_hwpoisoned_page(folio)) {
> +	if (folio_has_hwpoisoned_page(folio)) {
>   		folio_unlock(folio);
>   		folio_put(folio);
>   		return -EIO;
> diff --git a/mm/vmscan.c b/mm/vmscan.c
> index 35c3bb15ae96..70e54ace0e74 100644
> --- a/mm/vmscan.c
> +++ b/mm/vmscan.c
> @@ -1086,7 +1086,7 @@ static unsigned int shrink_folio_list(struct list_head *folio_list,
>   		if (!folio_trylock(folio))
>   			goto keep;
>   
> -		if (folio_contain_hwpoisoned_page(folio)) {
> +		if (folio_has_hwpoisoned_page(folio)) {
>   			/*
>   			 * unmap_poisoned_folio() can't handle large
>   			 * folio, just skip it. memory_failure() will
> -- 
> 2.47.3
> 
> 

Looks fine.
Reviewed-by: Jane Chu <[email protected]>

-jane