linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm/memory_failure: reject unsupported non-folio compound page
@ 2026-02-05  0:56 Zi Yan
  2026-02-05  3:25 ` Miaohe Lin
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Zi Yan @ 2026-02-05  0:56 UTC (permalink / raw)
  To: David Hildenbrand
  Cc: Andrew Morton, Lorenzo Stoakes, Liam R. Howlett, Vlastimil Babka,
	Mike Rapoport, Suren Baghdasaryan, Michal Hocko, Miaohe Lin,
	Naoya Horiguchi, Zi Yan, Harry Yoo, Matthew Wilcox (Oracle),
	Yu Zhao, Baolin Wang, Wei Yang, linux-mm, linux-kernel,
	是参差

When !CONFIG_TRANSPARENT_HUGEPAGE, a non-folio compound page can appear in
a userspace mapping via either vm_insert_*() functions or
vm_operatios_struct->fault(). They are not folios, thus should not be
considered for folio operations like split. Change memory_failure() and
soft_offline_page() to reject these non-folio compound pages as
EOPNOTSUPP.

Add PageNonFolioCompound() helper function. This function is functionally
equivalent to folio_test_large() && !folio_test_large_rmappable(), but it
is supposed to be used on struct page. So open code it instead.

Fixes: 689b8986776c ("mm/memory-failure: improve large block size folio handling")
Reported-by: 是参差 <shicenci@gmail.com>
Closes: https://lore.kernel.org/all/PS1PPF7E1D7501F1E4F4441E7ECD056DEADAB98A@PS1PPF7E1D7501F.apcprd02.prod.outlook.com/
Signed-off-by: Zi Yan <ziy@nvidia.com>
---
 include/linux/page-flags.h | 16 ++++++++++++++++
 mm/memory-failure.c        |  9 ++++++---
 2 files changed, 22 insertions(+), 3 deletions(-)

diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
index f7a0e4af0c73..2fe8047f42a3 100644
--- a/include/linux/page-flags.h
+++ b/include/linux/page-flags.h
@@ -1102,6 +1102,22 @@ static inline bool folio_contain_hwpoisoned_page(struct folio *folio)
 
 bool is_free_buddy_page(const struct page *page);
 
+static inline bool PageNonFolioCompound(const struct page *page)
+{
+	if (PageCompound(page)) {
+		const struct page *head = compound_head(page);
+
+		/*
+		 * Without CONFIG_TRANSPARENT_HUGEPAGE, PG_large_rmappable
+		 * should not be set/used.
+		 */
+		return !IS_ENABLED(CONFIG_TRANSPARENT_HUGEPAGE) ||
+		       !test_bit(PG_large_rmappable, &head[1].flags.f);
+	}
+
+	return false;
+}
+
 #ifdef CONFIG_MIGRATION
 /*
  * This page is migratable through movable_ops (for selected typed pages
diff --git a/mm/memory-failure.c b/mm/memory-failure.c
index cf0d526e6d41..8b6b5950bb66 100644
--- a/mm/memory-failure.c
+++ b/mm/memory-failure.c
@@ -2440,9 +2440,12 @@ int memory_failure(unsigned long pfn, int flags)
 
 	folio = page_folio(p);
 
-	/* filter pages that are protected from hwpoison test by users */
+	/*
+	 * filter pages that are protected from hwpoison test by users or
+	 * unsupported non folio compound ones
+	 */
 	folio_lock(folio);
-	if (hwpoison_filter(p)) {
+	if (hwpoison_filter(p) || PageNonFolioCompound(p)) {
 		ClearPageHWPoison(p);
 		folio_unlock(folio);
 		folio_put(folio);
@@ -2945,7 +2948,7 @@ int soft_offline_page(unsigned long pfn, int flags)
 	ret = get_hwpoison_page(page, flags | MF_SOFT_OFFLINE);
 	put_online_mems();
 
-	if (hwpoison_filter(page)) {
+	if (hwpoison_filter(page) || PageNonFolioCompound(page)) {
 		if (ret > 0)
 			put_page(page);
 
-- 
2.51.0



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] mm/memory_failure: reject unsupported non-folio compound page
  2026-02-05  0:56 [PATCH] mm/memory_failure: reject unsupported non-folio compound page Zi Yan
@ 2026-02-05  3:25 ` Miaohe Lin
  2026-02-05  3:40   ` Zi Yan
  2026-02-05  3:34 ` Harry Yoo
  2026-02-05  3:56 ` Zi Yan
  2 siblings, 1 reply; 6+ messages in thread
From: Miaohe Lin @ 2026-02-05  3:25 UTC (permalink / raw)
  To: Zi Yan, David Hildenbrand
  Cc: Andrew Morton, Lorenzo Stoakes, Liam R. Howlett, Vlastimil Babka,
	Mike Rapoport, Suren Baghdasaryan, Michal Hocko, Naoya Horiguchi,
	Harry Yoo, Matthew Wilcox (Oracle),
	Yu Zhao, Baolin Wang, Wei Yang, linux-mm, linux-kernel,
	是参差

On 2026/2/5 8:56, Zi Yan wrote:
> When !CONFIG_TRANSPARENT_HUGEPAGE, a non-folio compound page can appear in
> a userspace mapping via either vm_insert_*() functions or
> vm_operatios_struct->fault(). They are not folios, thus should not be
> considered for folio operations like split. Change memory_failure() and
> soft_offline_page() to reject these non-folio compound pages as
> EOPNOTSUPP.
> 
> Add PageNonFolioCompound() helper function. This function is functionally
> equivalent to folio_test_large() && !folio_test_large_rmappable(), but it
> is supposed to be used on struct page. So open code it instead.
> 
> Fixes: 689b8986776c ("mm/memory-failure: improve large block size folio handling")
> Reported-by: 是参差 <shicenci@gmail.com>
> Closes: https://lore.kernel.org/all/PS1PPF7E1D7501F1E4F4441E7ECD056DEADAB98A@PS1PPF7E1D7501F.apcprd02.prod.outlook.com/
> Signed-off-by: Zi Yan <ziy@nvidia.com>
> ---
>  include/linux/page-flags.h | 16 ++++++++++++++++
>  mm/memory-failure.c        |  9 ++++++---
>  2 files changed, 22 insertions(+), 3 deletions(-)
> 
> diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
> index f7a0e4af0c73..2fe8047f42a3 100644
> --- a/include/linux/page-flags.h
> +++ b/include/linux/page-flags.h
> @@ -1102,6 +1102,22 @@ static inline bool folio_contain_hwpoisoned_page(struct folio *folio)
>  
>  bool is_free_buddy_page(const struct page *page);
>  
> +static inline bool PageNonFolioCompound(const struct page *page)
> +{
> +	if (PageCompound(page)) {
> +		const struct page *head = compound_head(page);
> +
> +		/*
> +		 * Without CONFIG_TRANSPARENT_HUGEPAGE, PG_large_rmappable
> +		 * should not be set/used.
> +		 */
> +		return !IS_ENABLED(CONFIG_TRANSPARENT_HUGEPAGE) ||
> +		       !test_bit(PG_large_rmappable, &head[1].flags.f);
> +	}
> +
> +	return false;
> +}
> +
>  #ifdef CONFIG_MIGRATION
>  /*
>   * This page is migratable through movable_ops (for selected typed pages
> diff --git a/mm/memory-failure.c b/mm/memory-failure.c
> index cf0d526e6d41..8b6b5950bb66 100644
> --- a/mm/memory-failure.c
> +++ b/mm/memory-failure.c
> @@ -2440,9 +2440,12 @@ int memory_failure(unsigned long pfn, int flags)
>  
>  	folio = page_folio(p);
>  
> -	/* filter pages that are protected from hwpoison test by users */
> +	/*
> +	 * filter pages that are protected from hwpoison test by users or
> +	 * unsupported non folio compound ones
> +	 */
>  	folio_lock(folio);
> -	if (hwpoison_filter(p)) {
> +	if (hwpoison_filter(p) || PageNonFolioCompound(p)) {
>  		ClearPageHWPoison(p);
>  		folio_unlock(folio);
>  		folio_put(folio);
> @@ -2945,7 +2948,7 @@ int soft_offline_page(unsigned long pfn, int flags)
>  	ret = get_hwpoison_page(page, flags | MF_SOFT_OFFLINE);
>  	put_online_mems();
>  
> -	if (hwpoison_filter(page)) {
> +	if (hwpoison_filter(page) || PageNonFolioCompound(page)) {

There should be no problem in soft_offline_page(). HWPoisonHandlable() check will be used
by get_hwpoison_page() to reject PageNonFolioCompound folios. Or am I miss something?

Thanks.
.



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] mm/memory_failure: reject unsupported non-folio compound page
  2026-02-05  0:56 [PATCH] mm/memory_failure: reject unsupported non-folio compound page Zi Yan
  2026-02-05  3:25 ` Miaohe Lin
@ 2026-02-05  3:34 ` Harry Yoo
  2026-02-05  3:56 ` Zi Yan
  2 siblings, 0 replies; 6+ messages in thread
From: Harry Yoo @ 2026-02-05  3:34 UTC (permalink / raw)
  To: Zi Yan
  Cc: David Hildenbrand, Andrew Morton, Lorenzo Stoakes,
	Liam R. Howlett, Vlastimil Babka, Mike Rapoport,
	Suren Baghdasaryan, Michal Hocko, Miaohe Lin, Naoya Horiguchi,
	Matthew Wilcox (Oracle),
	Yu Zhao, Baolin Wang, Wei Yang, linux-mm, linux-kernel,
	是参差

On Wed, Feb 04, 2026 at 07:56:03PM -0500, Zi Yan wrote:
> When !CONFIG_TRANSPARENT_HUGEPAGE, a non-folio compound page can appear in
> a userspace mapping via either vm_insert_*() functions or
> vm_operatios_struct->fault(). They are not folios, thus should not be
> considered for folio operations like split. Change memory_failure() and
> soft_offline_page() to reject these non-folio compound pages as
> EOPNOTSUPP.
> 
> Add PageNonFolioCompound() helper function. This function is functionally
> equivalent to folio_test_large() && !folio_test_large_rmappable(), but it
> is supposed to be used on struct page. So open code it instead.
> 
> Fixes: 689b8986776c ("mm/memory-failure: improve large block size folio handling")
> Reported-by: 是参差 <shicenci@gmail.com>
> Closes: https://lore.kernel.org/all/PS1PPF7E1D7501F1E4F4441E7ECD056DEADAB98A@PS1PPF7E1D7501F.apcprd02.prod.outlook.com/
> Signed-off-by: Zi Yan <ziy@nvidia.com>
> ---

Looks good to me,
Acked-by: Harry Yoo <harry.yoo@oracle.com>

-- 
Cheers,
Harry / Hyeonggon


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] mm/memory_failure: reject unsupported non-folio compound page
  2026-02-05  3:25 ` Miaohe Lin
@ 2026-02-05  3:40   ` Zi Yan
  2026-02-05  3:51     ` Harry Yoo
  0 siblings, 1 reply; 6+ messages in thread
From: Zi Yan @ 2026-02-05  3:40 UTC (permalink / raw)
  To: Miaohe Lin
  Cc: David Hildenbrand, Andrew Morton, Lorenzo Stoakes,
	Liam R. Howlett, Vlastimil Babka, Mike Rapoport,
	Suren Baghdasaryan, Michal Hocko, Naoya Horiguchi, Harry Yoo,
	Matthew Wilcox (Oracle),
	Yu Zhao, Baolin Wang, Wei Yang, linux-mm, linux-kernel,
	是参差

On 4 Feb 2026, at 22:25, Miaohe Lin wrote:

> On 2026/2/5 8:56, Zi Yan wrote:
>> When !CONFIG_TRANSPARENT_HUGEPAGE, a non-folio compound page can appear in
>> a userspace mapping via either vm_insert_*() functions or
>> vm_operatios_struct->fault(). They are not folios, thus should not be
>> considered for folio operations like split. Change memory_failure() and
>> soft_offline_page() to reject these non-folio compound pages as
>> EOPNOTSUPP.
>>
>> Add PageNonFolioCompound() helper function. This function is functionally
>> equivalent to folio_test_large() && !folio_test_large_rmappable(), but it
>> is supposed to be used on struct page. So open code it instead.
>>
>> Fixes: 689b8986776c ("mm/memory-failure: improve large block size folio handling")
>> Reported-by: 是参差 <shicenci@gmail.com>
>> Closes: https://lore.kernel.org/all/PS1PPF7E1D7501F1E4F4441E7ECD056DEADAB98A@PS1PPF7E1D7501F.apcprd02.prod.outlook.com/
>> Signed-off-by: Zi Yan <ziy@nvidia.com>
>> ---
>>  include/linux/page-flags.h | 16 ++++++++++++++++
>>  mm/memory-failure.c        |  9 ++++++---
>>  2 files changed, 22 insertions(+), 3 deletions(-)
>>
>> diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
>> index f7a0e4af0c73..2fe8047f42a3 100644
>> --- a/include/linux/page-flags.h
>> +++ b/include/linux/page-flags.h
>> @@ -1102,6 +1102,22 @@ static inline bool folio_contain_hwpoisoned_page(struct folio *folio)
>>
>>  bool is_free_buddy_page(const struct page *page);
>>
>> +static inline bool PageNonFolioCompound(const struct page *page)
>> +{
>> +	if (PageCompound(page)) {
>> +		const struct page *head = compound_head(page);
>> +
>> +		/*
>> +		 * Without CONFIG_TRANSPARENT_HUGEPAGE, PG_large_rmappable
>> +		 * should not be set/used.
>> +		 */
>> +		return !IS_ENABLED(CONFIG_TRANSPARENT_HUGEPAGE) ||
>> +		       !test_bit(PG_large_rmappable, &head[1].flags.f);
>> +	}
>> +
>> +	return false;
>> +}
>> +
>>  #ifdef CONFIG_MIGRATION
>>  /*
>>   * This page is migratable through movable_ops (for selected typed pages
>> diff --git a/mm/memory-failure.c b/mm/memory-failure.c
>> index cf0d526e6d41..8b6b5950bb66 100644
>> --- a/mm/memory-failure.c
>> +++ b/mm/memory-failure.c
>> @@ -2440,9 +2440,12 @@ int memory_failure(unsigned long pfn, int flags)
>>
>>  	folio = page_folio(p);
>>
>> -	/* filter pages that are protected from hwpoison test by users */
>> +	/*
>> +	 * filter pages that are protected from hwpoison test by users or
>> +	 * unsupported non folio compound ones
>> +	 */
>>  	folio_lock(folio);
>> -	if (hwpoison_filter(p)) {
>> +	if (hwpoison_filter(p) || PageNonFolioCompound(p)) {
>>  		ClearPageHWPoison(p);
>>  		folio_unlock(folio);
>>  		folio_put(folio);
>> @@ -2945,7 +2948,7 @@ int soft_offline_page(unsigned long pfn, int flags)
>>  	ret = get_hwpoison_page(page, flags | MF_SOFT_OFFLINE);
>>  	put_online_mems();
>>
>> -	if (hwpoison_filter(page)) {
>> +	if (hwpoison_filter(page) || PageNonFolioCompound(page)) {
>
> There should be no problem in soft_offline_page(). HWPoisonHandlable() check will be used
> by get_hwpoison_page() to reject PageNonFolioCompound folios. Or am I miss something?

I did not know that. Why does memory_failure() not call HWPosonHandlable() to check the input
page? It looks to me that HWPosonHandlable() is more appropriate than PageNonFolioCompound()
here.

--
Best Regards,
Yan, Zi


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] mm/memory_failure: reject unsupported non-folio compound page
  2026-02-05  3:40   ` Zi Yan
@ 2026-02-05  3:51     ` Harry Yoo
  0 siblings, 0 replies; 6+ messages in thread
From: Harry Yoo @ 2026-02-05  3:51 UTC (permalink / raw)
  To: Zi Yan
  Cc: Miaohe Lin, David Hildenbrand, Andrew Morton, Lorenzo Stoakes,
	Liam R. Howlett, Vlastimil Babka, Mike Rapoport,
	Suren Baghdasaryan, Michal Hocko, Naoya Horiguchi,
	Matthew Wilcox (Oracle),
	Yu Zhao, Baolin Wang, Wei Yang, linux-mm, linux-kernel,
	是参差

On Wed, Feb 04, 2026 at 10:40:22PM -0500, Zi Yan wrote:
> On 4 Feb 2026, at 22:25, Miaohe Lin wrote:
> 
> > On 2026/2/5 8:56, Zi Yan wrote:
> >> When !CONFIG_TRANSPARENT_HUGEPAGE, a non-folio compound page can appear in
> >> a userspace mapping via either vm_insert_*() functions or
> >> vm_operatios_struct->fault(). They are not folios, thus should not be
> >> considered for folio operations like split. Change memory_failure() and
> >> soft_offline_page() to reject these non-folio compound pages as
> >> EOPNOTSUPP.
> >>
> >> Add PageNonFolioCompound() helper function. This function is functionally
> >> equivalent to folio_test_large() && !folio_test_large_rmappable(), but it
> >> is supposed to be used on struct page. So open code it instead.
> >>
> >> Fixes: 689b8986776c ("mm/memory-failure: improve large block size folio handling")
> >> Reported-by: 是参差 <shicenci@gmail.com>
> >> Closes: https://lore.kernel.org/all/PS1PPF7E1D7501F1E4F4441E7ECD056DEADAB98A@PS1PPF7E1D7501F.apcprd02.prod.outlook.com/
> >> Signed-off-by: Zi Yan <ziy@nvidia.com>
> >> ---
> >>  include/linux/page-flags.h | 16 ++++++++++++++++
> >>  mm/memory-failure.c        |  9 ++++++---
> >>  2 files changed, 22 insertions(+), 3 deletions(-)
> >>
> >> diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
> >> index f7a0e4af0c73..2fe8047f42a3 100644
> >> --- a/include/linux/page-flags.h
> >> +++ b/include/linux/page-flags.h
> >> @@ -1102,6 +1102,22 @@ static inline bool folio_contain_hwpoisoned_page(struct folio *folio)
> >>
> >>  bool is_free_buddy_page(const struct page *page);
> >>
> >> +static inline bool PageNonFolioCompound(const struct page *page)
> >> +{
> >> +	if (PageCompound(page)) {
> >> +		const struct page *head = compound_head(page);
> >> +
> >> +		/*
> >> +		 * Without CONFIG_TRANSPARENT_HUGEPAGE, PG_large_rmappable
> >> +		 * should not be set/used.
> >> +		 */
> >> +		return !IS_ENABLED(CONFIG_TRANSPARENT_HUGEPAGE) ||
> >> +		       !test_bit(PG_large_rmappable, &head[1].flags.f);
> >> +	}
> >> +
> >> +	return false;
> >> +}
> >> +
> >>  #ifdef CONFIG_MIGRATION
> >>  /*
> >>   * This page is migratable through movable_ops (for selected typed pages
> >> diff --git a/mm/memory-failure.c b/mm/memory-failure.c
> >> index cf0d526e6d41..8b6b5950bb66 100644
> >> --- a/mm/memory-failure.c
> >> +++ b/mm/memory-failure.c
> >> @@ -2440,9 +2440,12 @@ int memory_failure(unsigned long pfn, int flags)
> >>
> >>  	folio = page_folio(p);
> >>
> >> -	/* filter pages that are protected from hwpoison test by users */
> >> +	/*
> >> +	 * filter pages that are protected from hwpoison test by users or
> >> +	 * unsupported non folio compound ones
> >> +	 */
> >>  	folio_lock(folio);
> >> -	if (hwpoison_filter(p)) {
> >> +	if (hwpoison_filter(p) || PageNonFolioCompound(p)) {
> >>  		ClearPageHWPoison(p);
> >>  		folio_unlock(folio);
> >>  		folio_put(folio);
> >> @@ -2945,7 +2948,7 @@ int soft_offline_page(unsigned long pfn, int flags)
> >>  	ret = get_hwpoison_page(page, flags | MF_SOFT_OFFLINE);
> >>  	put_online_mems();
> >>
> >> -	if (hwpoison_filter(page)) {
> >> +	if (hwpoison_filter(page) || PageNonFolioCompound(page)) {
> >
> > There should be no problem in soft_offline_page(). HWPoisonHandlable() check will be used
> > by get_hwpoison_page() to reject PageNonFolioCompound folios. Or am I miss something?

Oops, I missed Miohe's email.
So it's rejected because it's not on LRU.

> I did not know that. Why does memory_failure() not call HWPosonHandlable() to check the input
> page? It looks to me that HWPosonHandlable() is more appropriate than PageNonFolioCompound()
> here.

soft_offline_page() unconditionally calls get_hwpoison_page(), but
memory_failure() doesn't call it if MF_COUNT_INCREASED is set.

(MF_COUNT_INCREASED set by madvise_inject_error(), in this case)

-- 
Cheers,
Harry / Hyeonggon


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] mm/memory_failure: reject unsupported non-folio compound page
  2026-02-05  0:56 [PATCH] mm/memory_failure: reject unsupported non-folio compound page Zi Yan
  2026-02-05  3:25 ` Miaohe Lin
  2026-02-05  3:34 ` Harry Yoo
@ 2026-02-05  3:56 ` Zi Yan
  2 siblings, 0 replies; 6+ messages in thread
From: Zi Yan @ 2026-02-05  3:56 UTC (permalink / raw)
  To: Andrew Morton, Miaohe Lin
  Cc: David Hildenbrand, Lorenzo Stoakes, Liam R. Howlett,
	Vlastimil Babka, Mike Rapoport, Suren Baghdasaryan, Michal Hocko,
	Naoya Horiguchi, Zi Yan, Harry Yoo, Matthew Wilcox (Oracle),
	Yu Zhao, Baolin Wang, Wei Yang, linux-mm, linux-kernel,
	是参差

Hi Andrew,

Miaohe has a more appropriate solution[1]. I think it is better to drop this patch
and wait for Miaohe's proper patch fix.

Thanks.


[1] https://lore.kernel.org/all/c5206f67-1e9e-d487-3514-8867f00cc626@huawei.com/


On 4 Feb 2026, at 19:56, Zi Yan wrote:

> When !CONFIG_TRANSPARENT_HUGEPAGE, a non-folio compound page can appear in
> a userspace mapping via either vm_insert_*() functions or
> vm_operatios_struct->fault(). They are not folios, thus should not be
> considered for folio operations like split. Change memory_failure() and
> soft_offline_page() to reject these non-folio compound pages as
> EOPNOTSUPP.
>
> Add PageNonFolioCompound() helper function. This function is functionally
> equivalent to folio_test_large() && !folio_test_large_rmappable(), but it
> is supposed to be used on struct page. So open code it instead.
>
> Fixes: 689b8986776c ("mm/memory-failure: improve large block size folio handling")
> Reported-by: 是参差 <shicenci@gmail.com>
> Closes: https://lore.kernel.org/all/PS1PPF7E1D7501F1E4F4441E7ECD056DEADAB98A@PS1PPF7E1D7501F.apcprd02.prod.outlook.com/
> Signed-off-by: Zi Yan <ziy@nvidia.com>
> ---
>  include/linux/page-flags.h | 16 ++++++++++++++++
>  mm/memory-failure.c        |  9 ++++++---
>  2 files changed, 22 insertions(+), 3 deletions(-)
>
> diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
> index f7a0e4af0c73..2fe8047f42a3 100644
> --- a/include/linux/page-flags.h
> +++ b/include/linux/page-flags.h
> @@ -1102,6 +1102,22 @@ static inline bool folio_contain_hwpoisoned_page(struct folio *folio)
>
>  bool is_free_buddy_page(const struct page *page);
>
> +static inline bool PageNonFolioCompound(const struct page *page)
> +{
> +	if (PageCompound(page)) {
> +		const struct page *head = compound_head(page);
> +
> +		/*
> +		 * Without CONFIG_TRANSPARENT_HUGEPAGE, PG_large_rmappable
> +		 * should not be set/used.
> +		 */
> +		return !IS_ENABLED(CONFIG_TRANSPARENT_HUGEPAGE) ||
> +		       !test_bit(PG_large_rmappable, &head[1].flags.f);
> +	}
> +
> +	return false;
> +}
> +
>  #ifdef CONFIG_MIGRATION
>  /*
>   * This page is migratable through movable_ops (for selected typed pages
> diff --git a/mm/memory-failure.c b/mm/memory-failure.c
> index cf0d526e6d41..8b6b5950bb66 100644
> --- a/mm/memory-failure.c
> +++ b/mm/memory-failure.c
> @@ -2440,9 +2440,12 @@ int memory_failure(unsigned long pfn, int flags)
>
>  	folio = page_folio(p);
>
> -	/* filter pages that are protected from hwpoison test by users */
> +	/*
> +	 * filter pages that are protected from hwpoison test by users or
> +	 * unsupported non folio compound ones
> +	 */
>  	folio_lock(folio);
> -	if (hwpoison_filter(p)) {
> +	if (hwpoison_filter(p) || PageNonFolioCompound(p)) {
>  		ClearPageHWPoison(p);
>  		folio_unlock(folio);
>  		folio_put(folio);
> @@ -2945,7 +2948,7 @@ int soft_offline_page(unsigned long pfn, int flags)
>  	ret = get_hwpoison_page(page, flags | MF_SOFT_OFFLINE);
>  	put_online_mems();
>
> -	if (hwpoison_filter(page)) {
> +	if (hwpoison_filter(page) || PageNonFolioCompound(page)) {
>  		if (ret > 0)
>  			put_page(page);
>
> -- 
> 2.51.0


--
Best Regards,
Yan, Zi


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-02-05  3:56 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-02-05  0:56 [PATCH] mm/memory_failure: reject unsupported non-folio compound page Zi Yan
2026-02-05  3:25 ` Miaohe Lin
2026-02-05  3:40   ` Zi Yan
2026-02-05  3:51     ` Harry Yoo
2026-02-05  3:34 ` Harry Yoo
2026-02-05  3:56 ` Zi Yan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox