linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -V2] mm/THP: Use pmd_populate to update the pmd with pgtable_t pointer
@ 2013-05-13 14:56 Aneesh Kumar K.V
  2013-05-13 15:00 ` Andrea Arcangeli
  0 siblings, 1 reply; 2+ messages in thread
From: Aneesh Kumar K.V @ 2013-05-13 14:56 UTC (permalink / raw)
  To: linux-mm, akpm, aarcange; +Cc: Aneesh Kumar K.V

From: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>

We should not use set_pmd_at to update pmd_t with pgtable_t pointer. set_pmd_at
is used to set pmd with huge pte entries and architectures like ppc64, clear
few flags from the pte when saving a new entry. Without this change we observe
bad pte errors like below on ppc64 with THP enabled.

BUG: Bad page map in process ld mm=0xc000001ee39f4780 pte:7fc3f37848000001 pmd:c000001ec0000000
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
---
 mm/huge_memory.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/mm/huge_memory.c b/mm/huge_memory.c
index 03a89a2..362c329 100644
--- a/mm/huge_memory.c
+++ b/mm/huge_memory.c
@@ -2325,7 +2325,12 @@ static void collapse_huge_page(struct mm_struct *mm,
 		pte_unmap(pte);
 		spin_lock(&mm->page_table_lock);
 		BUG_ON(!pmd_none(*pmd));
-		set_pmd_at(mm, address, pmd, _pmd);
+		/*
+		 * We can only use set_pmd_at when establishing
+		 * hugepmds and never for establishing regular pmds that
+		 * points to regular pagetables. Use pmd_populate for that
+		 */
+		pmd_populate(mm, pmd, pmd_pgtable(_pmd));
 		spin_unlock(&mm->page_table_lock);
 		anon_vma_unlock_write(vma->anon_vma);
 		goto out;
-- 
1.8.1.2

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

* Re: [PATCH -V2] mm/THP: Use pmd_populate to update the pmd with pgtable_t pointer
  2013-05-13 14:56 [PATCH -V2] mm/THP: Use pmd_populate to update the pmd with pgtable_t pointer Aneesh Kumar K.V
@ 2013-05-13 15:00 ` Andrea Arcangeli
  0 siblings, 0 replies; 2+ messages in thread
From: Andrea Arcangeli @ 2013-05-13 15:00 UTC (permalink / raw)
  To: Aneesh Kumar K.V; +Cc: linux-mm, akpm

On Mon, May 13, 2013 at 08:26:40PM +0530, Aneesh Kumar K.V wrote:
> From: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
> 
> We should not use set_pmd_at to update pmd_t with pgtable_t pointer. set_pmd_at
> is used to set pmd with huge pte entries and architectures like ppc64, clear
> few flags from the pte when saving a new entry. Without this change we observe
> bad pte errors like below on ppc64 with THP enabled.
> 
> BUG: Bad page map in process ld mm=0xc000001ee39f4780 pte:7fc3f37848000001 pmd:c000001ec0000000
> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
> ---
>  mm/huge_memory.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/mm/huge_memory.c b/mm/huge_memory.c
> index 03a89a2..362c329 100644
> --- a/mm/huge_memory.c
> +++ b/mm/huge_memory.c
> @@ -2325,7 +2325,12 @@ static void collapse_huge_page(struct mm_struct *mm,
>  		pte_unmap(pte);
>  		spin_lock(&mm->page_table_lock);
>  		BUG_ON(!pmd_none(*pmd));
> -		set_pmd_at(mm, address, pmd, _pmd);
> +		/*
> +		 * We can only use set_pmd_at when establishing
> +		 * hugepmds and never for establishing regular pmds that
> +		 * points to regular pagetables. Use pmd_populate for that
> +		 */
> +		pmd_populate(mm, pmd, pmd_pgtable(_pmd));
>  		spin_unlock(&mm->page_table_lock);
>  		anon_vma_unlock_write(vma->anon_vma);
>  		goto out;

Reviewed-by: Andrea Arcangeli <aarcange@redhat.com>

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

end of thread, other threads:[~2013-05-13 15:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-13 14:56 [PATCH -V2] mm/THP: Use pmd_populate to update the pmd with pgtable_t pointer Aneesh Kumar K.V
2013-05-13 15:00 ` Andrea Arcangeli

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).