diff mbox series

arch/powerpc/mm: Enable compound page check for both THP and HugeTLB

Message ID 20200320103256.229365-1-aneesh.kumar@linux.ibm.com (mailing list archive)
State Changes Requested
Headers show
Series arch/powerpc/mm: Enable compound page check for both THP and HugeTLB | expand

Checks

Context Check Description
snowpatch_ozlabs/apply_patch success Successfully applied on branch powerpc/merge (8a445cbcb9f5090cb07ec6cbb89a8a1fc99a0ff7)
snowpatch_ozlabs/build-ppc64le success Build succeeded
snowpatch_ozlabs/build-ppc64be success Build succeeded
snowpatch_ozlabs/build-ppc64e success Build succeeded
snowpatch_ozlabs/build-pmac32 success Build succeeded
snowpatch_ozlabs/checkpatch success total: 0 errors, 0 warnings, 0 checks, 8 lines checked
snowpatch_ozlabs/needsstable success Patch has no Fixes tags

Commit Message

Aneesh Kumar K V March 20, 2020, 10:32 a.m. UTC
THP config can result in compound pages. Make sure kernel enables the
PageCompound() check when only THP is enabled.

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
---
 arch/powerpc/mm/mem.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Michael Ellerman March 24, 2020, 6:38 a.m. UTC | #1
"Aneesh Kumar K.V" <aneesh.kumar@linux.ibm.com> writes:
> THP config can result in compound pages. Make sure kernel enables the
> PageCompound() check when only THP is enabled.

Or else what happens ... nothing, rampant data corruption, something in
between?

And "when only THP is enabled" is not very clear, AFAIK there is no
relation between CONFIG_TRANSPARENT_HUGEPAGE and CONFIG_HUGETLB_PAGE.

You mean when either or both of THP or HUGETLB is enabled right?

cheers


> diff --git a/arch/powerpc/mm/mem.c b/arch/powerpc/mm/mem.c
> index 9b4f5fb719e0..b03cbddf9054 100644
> --- a/arch/powerpc/mm/mem.c
> +++ b/arch/powerpc/mm/mem.c
> @@ -485,7 +485,7 @@ EXPORT_SYMBOL(flush_dcache_page);
>  
>  void flush_dcache_icache_page(struct page *page)
>  {
> -#ifdef CONFIG_HUGETLB_PAGE
> +#if defined(CONFIG_TRANSPARENT_HUGEPAGE) || defined(CONFIG_HUGETLB_PAGE)
>  	if (PageCompound(page)) {
>  		flush_dcache_icache_hugepage(page);
>  		return;
> -- 
> 2.25.1
Aneesh Kumar K V March 24, 2020, 6:46 a.m. UTC | #2
On 3/24/20 12:08 PM, Michael Ellerman wrote:
> "Aneesh Kumar K.V" <aneesh.kumar@linux.ibm.com> writes:
>> THP config can result in compound pages. Make sure kernel enables the
>> PageCompound() check when only THP is enabled.
> 
> Or else what happens ... nothing, rampant data corruption, something in
> between?
> 

We can get a stale icache that can result in undefined behavior?



> And "when only THP is enabled" is not very clear, AFAIK there is no
> relation between CONFIG_TRANSPARENT_HUGEPAGE and CONFIG_HUGETLB_PAGE.
> 


yes, there is no relation between them. But the way current code is 
enabled if we have both enabled, we will find that
if (PageCompound(page)) check present which will handle THP case too.

Now with current code if we have CONFIG_HUGETLB_PAGE disabled, we 
compile out if (pageCompound(page)) check and hence don't invalidate 
compound pages correctly (THP create compound pages here)

> You mean when either or both of THP or HUGETLB is enabled right?
> 
> cheers
> 
> 
>> diff --git a/arch/powerpc/mm/mem.c b/arch/powerpc/mm/mem.c
>> index 9b4f5fb719e0..b03cbddf9054 100644
>> --- a/arch/powerpc/mm/mem.c
>> +++ b/arch/powerpc/mm/mem.c
>> @@ -485,7 +485,7 @@ EXPORT_SYMBOL(flush_dcache_page);
>>   
>>   void flush_dcache_icache_page(struct page *page)
>>   {
>> -#ifdef CONFIG_HUGETLB_PAGE
>> +#if defined(CONFIG_TRANSPARENT_HUGEPAGE) || defined(CONFIG_HUGETLB_PAGE)
>>   	if (PageCompound(page)) {
>>   		flush_dcache_icache_hugepage(page);
>>   		return;
>> -- 
>> 2.25.1
diff mbox series

Patch

diff --git a/arch/powerpc/mm/mem.c b/arch/powerpc/mm/mem.c
index 9b4f5fb719e0..b03cbddf9054 100644
--- a/arch/powerpc/mm/mem.c
+++ b/arch/powerpc/mm/mem.c
@@ -485,7 +485,7 @@  EXPORT_SYMBOL(flush_dcache_page);
 
 void flush_dcache_icache_page(struct page *page)
 {
-#ifdef CONFIG_HUGETLB_PAGE
+#if defined(CONFIG_TRANSPARENT_HUGEPAGE) || defined(CONFIG_HUGETLB_PAGE)
 	if (PageCompound(page)) {
 		flush_dcache_icache_hugepage(page);
 		return;