Skip to contentSkip to conversation

Minor changes to common hugetlb code for ARM

PATCH In review Will Deacon 10 participants 27 messages Sep 11, 2012 – Sep 20, 2012

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

cover Minor changes to common hugetlb code for ARM

Hello,

A few changes are required to common hugetlb code before the ARM support can be merged. I posted the main one previously, which has been picked up by akpm:

http://marc.info/?l=linux-mm&m=134573987631394&w=2

The remaining three patches (included here) are all fairly minor but do affect other architectures.

All comments welcome,

Will

Catalin Marinas (2):
mm: thp: Fix the pmd_clear() arguments in pmdp_get_and_clear()
mm: thp: Fix the update_mmu_cache() last argument passing in
mm/huge_memory.c

Steve Capper (1):
mm: Introduce HAVE_ARCH_TRANSPARENT_HUGEPAGE

 arch/x86/Kconfig              |    4 ++++
 include/asm-generic/pgtable.h |    2 +-
 mm/Kconfig                    |    2 +-
 mm/huge_memory.c              |    6 +++---
 4 files changed, 9 insertions(+), 5 deletions(-)
Signature · 1 line
1.7.4.1
#1 lore raw

PATCH 1/3 mm: thp: Fix the pmd_clear() arguments in pmdp_get_and_clear()

From: Catalin Marinas <[email protected]>

The CONFIG_TRANSPARENT_HUGEPAGE implementation of pmdp_get_and_clear() calls pmd_clear() with 3 arguments instead of 1.

---
 include/asm-generic/pgtable.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
include/asm-generic/pgtable.h +1 -1
index ff4947b..f7e0206 100644
@@ -87,7 +87,7 @@ static inline pmd_t pmdp_get_and_clear(struct mm_struct *mm,
 				       pmd_t *pmdp)
 {
 	pmd_t pmd = *pmdp;
-	pmd_clear(mm, address, pmdp);
+	pmd_clear(pmdp);
 	return pmd;
 }
 #endif /* CONFIG_TRANSPARENT_HUGEPAGE */
Signature · 7 lines
1.7.4.1

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Reviewed-by on v1 1/3
#2 lore raw

Re: [PATCH 1/3] mm: thp: Fix the pmd_clear() arguments in pmdp_get_and_clear()

Quoted 9 lines · Will Deacon

From: Catalin Marinas <[email protected]>

The CONFIG_TRANSPARENT_HUGEPAGE implementation of pmdp_get_and_clear() calls pmd_clear() with 3 arguments instead of 1.

Quoted 25 lines
---
 include/asm-generic/pgtable.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
include/asm-generic/pgtable.h +1 -1
index ff4947b..f7e0206 100644
@@ -87,7 +87,7 @@ static inline pmd_t pmdp_get_and_clear(struct mm_struct *mm,
 				       pmd_t *pmdp)
 {
 	pmd_t pmd = *pmdp;
-	pmd_clear(mm, address, pmdp);
+	pmd_clear(pmdp);
 	return pmd;
 }
 #endif /* CONFIG_TRANSPARENT_HUGEPAGE */
Signature · 7 lines
1.7.4.1

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Signature · 7 lines
 Kirill A. Shutemov

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Reviewed-by on v1 1/3
#3 lore raw

Re: [PATCH 1/3] mm: thp: Fix the pmd_clear() arguments in pmdp_get_and_clear()

In reply to Will Deacon
Quoted 4 lines · Will Deacon

From: Catalin Marinas <[email protected]>

The CONFIG_TRANSPARENT_HUGEPAGE implementation of pmdp_get_and_clear() calls pmd_clear() with 3 arguments instead of 1.

only for !__HAVE_ARCH_PMDP_GET_AND_CLEAR which doesn't seem to happen because x86 defines this and it uses pmd_update.

Quoted 5 lines

Other than that it looks good.

Quoted 20 lines
---
 include/asm-generic/pgtable.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
include/asm-generic/pgtable.h +1 -1
index ff4947b..f7e0206 100644
@@ -87,7 +87,7 @@ static inline pmd_t pmdp_get_and_clear(struct mm_struct *mm,
 				       pmd_t *pmdp)
 {
 	pmd_t pmd = *pmdp;
-	pmd_clear(mm, address, pmdp);
+	pmd_clear(pmdp);
 	return pmd;
 }
 #endif /* CONFIG_TRANSPARENT_HUGEPAGE */
Signature · 1 line
1.7.4.1
Signature · 2 lines
Michal Hocko
SUSE Labs
#4 lore raw

PATCH 2/3 mm: thp: Fix the update_mmu_cache() last argument passing in mm/huge_memory.c

In reply to Will Deacon

From: Catalin Marinas <[email protected]>

The update_mmu_cache() takes a pointer (to pte_t by default) as the last argument but the huge_memory.c passes a pmd_t value. The patch changes the argument to the pmd_t * pointer.

---
 mm/huge_memory.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
mm/huge_memory.c +3 -3
index 57c4b93..4aa6d02 100644
@@ -934,7 +934,7 @@ int do_huge_pmd_wp_page(struct mm_struct *mm, struct vm_area_struct *vma,
 		entry = pmd_mkyoung(orig_pmd);
 		entry = maybe_pmd_mkwrite(pmd_mkdirty(entry), vma);
 		if (pmdp_set_access_flags(vma, haddr, pmd, entry,  1))
-			update_mmu_cache(vma, address, entry);
+			update_mmu_cache(vma, address, pmd);
 		ret |= VM_FAULT_WRITE;
 		goto out_unlock;
 	}
@@ -986,7 +986,7 @@ int do_huge_pmd_wp_page(struct mm_struct *mm, struct vm_area_struct *vma,
 		pmdp_clear_flush_notify(vma, haddr, pmd);
 		page_add_new_anon_rmap(new_page, vma, haddr);
 		set_pmd_at(mm, haddr, pmd, entry);
-		update_mmu_cache(vma, address, entry);
+		update_mmu_cache(vma, address, pmd);
 		page_remove_rmap(page);
 		put_page(page);
 		ret |= VM_FAULT_WRITE;
@@ -1989,7 +1989,7 @@ static void collapse_huge_page(struct mm_struct *mm,
 	BUG_ON(!pmd_none(*pmd));
 	page_add_new_anon_rmap(new_page, vma, address);
 	set_pmd_at(mm, address, pmd, _pmd);
-	update_mmu_cache(vma, address, _pmd);
+	update_mmu_cache(vma, address, pmd);
 	prepare_pmd_huge_pte(pgtable, mm);
 	spin_unlock(&mm->page_table_lock);
 
Signature · 7 lines
1.7.4.1

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Reviewed-by on v1 2/3
#5 lore raw

Re: [PATCH 2/3] mm: thp: Fix the update_mmu_cache() last argument passing in mm/huge_memory.c

Quoted 9 lines · Will Deacon

From: Catalin Marinas <[email protected]>

The update_mmu_cache() takes a pointer (to pte_t by default) as the last argument but the huge_memory.c passes a pmd_t value. The patch changes the argument to the pmd_t * pointer.

Quoted 43 lines
---
 mm/huge_memory.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
mm/huge_memory.c +3 -3
index 57c4b93..4aa6d02 100644
@@ -934,7 +934,7 @@ int do_huge_pmd_wp_page(struct mm_struct *mm, struct vm_area_struct *vma,
 		entry = pmd_mkyoung(orig_pmd);
 		entry = maybe_pmd_mkwrite(pmd_mkdirty(entry), vma);
 		if (pmdp_set_access_flags(vma, haddr, pmd, entry,  1))
-			update_mmu_cache(vma, address, entry);
+			update_mmu_cache(vma, address, pmd);
 		ret |= VM_FAULT_WRITE;
 		goto out_unlock;
 	}
@@ -986,7 +986,7 @@ int do_huge_pmd_wp_page(struct mm_struct *mm, struct vm_area_struct *vma,
 		pmdp_clear_flush_notify(vma, haddr, pmd);
 		page_add_new_anon_rmap(new_page, vma, haddr);
 		set_pmd_at(mm, haddr, pmd, entry);
-		update_mmu_cache(vma, address, entry);
+		update_mmu_cache(vma, address, pmd);
 		page_remove_rmap(page);
 		put_page(page);
 		ret |= VM_FAULT_WRITE;
@@ -1989,7 +1989,7 @@ static void collapse_huge_page(struct mm_struct *mm,
 	BUG_ON(!pmd_none(*pmd));
 	page_add_new_anon_rmap(new_page, vma, address);
 	set_pmd_at(mm, address, pmd, _pmd);
-	update_mmu_cache(vma, address, _pmd);
+	update_mmu_cache(vma, address, pmd);
 	prepare_pmd_huge_pte(pgtable, mm);
 	spin_unlock(&mm->page_table_lock);
 
Signature · 7 lines
1.7.4.1

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Signature · 7 lines
 Kirill A. Shutemov

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
#6 lore raw

Re: [PATCH 2/3] mm: thp: Fix the update_mmu_cache() last argument passing in mm/huge_memory.c

In reply to Will Deacon
Quoted 18 lines · Will Deacon

From: Catalin Marinas <[email protected]>

The update_mmu_cache() takes a pointer (to pte_t by default) as the last argument but the huge_memory.c passes a pmd_t value. The patch changes the argument to the pmd_t * pointer.

---
 mm/huge_memory.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
mm/huge_memory.c +0 -0
index 57c4b93..4aa6d02 100644

mm/huge_memory.c int do_huge_pmd_wp_page(struct mm_struct *mm, struct vm_area_struct *vma, · line 937

Quoted 5 lines
mm/huge_memory.c +1 -1
@@ -934,7 +934,7 @@ int do_huge_pmd_wp_page(struct mm_struct *mm, struct vm_area_struct *vma,
 		entry = pmd_mkyoung(orig_pmd);
 		entry = maybe_pmd_mkwrite(pmd_mkdirty(entry), vma);
 		if (pmdp_set_access_flags(vma, haddr, pmd, entry,  1))
-			update_mmu_cache(vma, address, entry);
+			update_mmu_cache(vma, address, pmd);

I am not sure but shouldn't we use the new entry rather than the given pmd?

Quoted 24 lines
mm/huge_memory.c +2 -2
 		ret |= VM_FAULT_WRITE;
 		goto out_unlock;
 	}
@@ -986,7 +986,7 @@ int do_huge_pmd_wp_page(struct mm_struct *mm, struct vm_area_struct *vma,
 		pmdp_clear_flush_notify(vma, haddr, pmd);
 		page_add_new_anon_rmap(new_page, vma, haddr);
 		set_pmd_at(mm, haddr, pmd, entry);
-		update_mmu_cache(vma, address, entry);
+		update_mmu_cache(vma, address, pmd);
 		page_remove_rmap(page);
 		put_page(page);
 		ret |= VM_FAULT_WRITE;
@@ -1989,7 +1989,7 @@ static void collapse_huge_page(struct mm_struct *mm,
 	BUG_ON(!pmd_none(*pmd));
 	page_add_new_anon_rmap(new_page, vma, address);
 	set_pmd_at(mm, address, pmd, _pmd);
-	update_mmu_cache(vma, address, _pmd);
+	update_mmu_cache(vma, address, pmd);
 	prepare_pmd_huge_pte(pgtable, mm);
 	spin_unlock(&mm->page_table_lock);
 
Signature · 1 line
1.7.4.1
Signature · 2 lines
Michal Hocko
SUSE Labs
#7 lore raw

Re: [PATCH 2/3] mm: thp: Fix the update_mmu_cache() last argument passing in mm/huge_memory.c

Quoted 14 lines · Michal Hocko
Quoted 13 lines · Will Deacon

From: Catalin Marinas <[email protected]>

The update_mmu_cache() takes a pointer (to pte_t by default) as the last argument but the huge_memory.c passes a pmd_t value. The patch changes the argument to the pmd_t * pointer.

---
 mm/huge_memory.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
Quoted 13 lines

mm/huge_memory.c int do_huge_pmd_wp_page(struct mm_struct *mm, struct vm_area_struct *vma, · line 937

Quoted 10 lines
mm/huge_memory.c +1 -1
index 57c4b93..4aa6d02 100644
@@ -934,7 +934,7 @@ int do_huge_pmd_wp_page(struct mm_struct *mm, struct vm_area_struct *vma,
 		entry = pmd_mkyoung(orig_pmd);
 		entry = maybe_pmd_mkwrite(pmd_mkdirty(entry), vma);
 		if (pmdp_set_access_flags(vma, haddr, pmd, entry,  1))
-			update_mmu_cache(vma, address, entry);
+			update_mmu_cache(vma, address, pmd);

I am not sure but shouldn't we use the new entry rather than the given pmd?

The pmd pointer is the new pmd and 'entry' is the new value derived from orig_pmd. update_mmu_cache() expects a pointer to pte_t or pmd_t rather than it's value.

Signature · 7 lines
Catalin

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
#8 lore raw

Re: [PATCH 2/3] mm: thp: Fix the update_mmu_cache() last argument passing in mm/huge_memory.c

In reply to Will Deacon
Quoted 16 lines · Will Deacon

The update_mmu_cache() takes a pointer (to pte_t by default) as the last argument but the huge_memory.c passes a pmd_t value. The patch changes the argument to the pmd_t * pointer.

---
 mm/huge_memory.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
mm/huge_memory.c +0 -0
index 57c4b93..4aa6d02 100644

mm/huge_memory.c int do_huge_pmd_wp_page(struct mm_struct *mm, struct vm_area_struct *vma, · line 937

Quoted 5 lines
mm/huge_memory.c +1 -1
@@ -934,7 +934,7 @@ int do_huge_pmd_wp_page(struct mm_struct *mm, struct vm_area_struct *vma,
 		entry = pmd_mkyoung(orig_pmd);
 		entry = maybe_pmd_mkwrite(pmd_mkdirty(entry), vma);
 		if (pmdp_set_access_flags(vma, haddr, pmd, entry,  1))
-			update_mmu_cache(vma, address, entry);
+			update_mmu_cache(vma, address, pmd);

Documentation/cachetlb.txt will need an update as well. Currently it says:

5) void update_mmu_cache(struct vm_area_struct *vma, unsigned long address, pte_t *ptep)

I would prefer we introduce something like update_mmu_cache_huge_page(vma, address, pmd) and leave the classic update_mmu_cache() unchanged.

Ralf

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

maintainer
#9 lore raw

Re: [PATCH 2/3] mm: thp: Fix the update_mmu_cache() last argument passing in mm/huge_memory.c

Quoted 26 lines · On Sat, 15 Sep 2012 15:38:33 +0200 Ralf Baechle <[email protected]> wrote:
Quoted 16 lines · Will Deacon

The update_mmu_cache() takes a pointer (to pte_t by default) as the last argument but the huge_memory.c passes a pmd_t value. The patch changes the argument to the pmd_t * pointer.

---
 mm/huge_memory.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
mm/huge_memory.c +0 -0
index 57c4b93..4aa6d02 100644

mm/huge_memory.c int do_huge_pmd_wp_page(struct mm_struct *mm, struct vm_area_struct *vma, · line 937

Quoted 5 lines
mm/huge_memory.c +1 -1
@@ -934,7 +934,7 @@ int do_huge_pmd_wp_page(struct mm_struct *mm, struct vm_area_struct *vma,
 		entry = pmd_mkyoung(orig_pmd);
 		entry = maybe_pmd_mkwrite(pmd_mkdirty(entry), vma);
 		if (pmdp_set_access_flags(vma, haddr, pmd, entry,  1))
-			update_mmu_cache(vma, address, entry);
+			update_mmu_cache(vma, address, pmd);

Documentation/cachetlb.txt will need an update as well. Currently it says:

Quoted 2 lines

5) void update_mmu_cache(struct vm_area_struct *vma, unsigned long address, pte_t *ptep)

Yes please.

Quoted 2 lines

I would prefer we introduce something like update_mmu_cache_huge_page(vma, address, pmd) and leave the classic update_mmu_cache() unchanged.

Why?

#10 lore raw

Re: [PATCH 2/3] mm: thp: Fix the update_mmu_cache() last argument passing in mm/huge_memory.c

Quoted 27 lines · Andrew Morton
Quoted 25 lines · On Sat, 15 Sep 2012 15:38:33 +0200 Ralf Baechle <[email protected]> wrote:
Quoted 16 lines · Will Deacon

The update_mmu_cache() takes a pointer (to pte_t by default) as the last argument but the huge_memory.c passes a pmd_t value. The patch changes the argument to the pmd_t * pointer.

---
 mm/huge_memory.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
mm/huge_memory.c +0 -0
index 57c4b93..4aa6d02 100644

mm/huge_memory.c int do_huge_pmd_wp_page(struct mm_struct *mm, struct vm_area_struct *vma, · line 937

Quoted 5 lines
mm/huge_memory.c +1 -1
@@ -934,7 +934,7 @@ int do_huge_pmd_wp_page(struct mm_struct *mm, struct vm_area_struct *vma,
            entry = pmd_mkyoung(orig_pmd);
            entry = maybe_pmd_mkwrite(pmd_mkdirty(entry), vma);
            if (pmdp_set_access_flags(vma, haddr, pmd, entry,  1))
-                   update_mmu_cache(vma, address, entry);
+                   update_mmu_cache(vma, address, pmd);

Documentation/cachetlb.txt will need an update as well. Currently it says:

Quoted 4 lines
Quoted 2 lines

5) void update_mmu_cache(struct vm_area_struct *vma, unsigned long address, pte_t *ptep)

Yes please.

Should we just use a generic (void *) for the last argument or force a cast in mm/huge_memory.c?

Ralf's point is that transparent huge page code calls update_mmu_cache with a (pmd_t *) as the last argument. This could make sense for THP as it assumes that huge pages can only be created at the pmd level. But that's unlike mm/hugetlb.c which casts huge page types to pte_t, even though on ARM they are implemented at the pmd level.

On ARM (with VIPT caches) update_mmu_cache() is empty like on x86, though a static inline rather than macro.

Signature · 1 line
Catalin
#11 lore raw

Re: [PATCH 2/3] mm: thp: Fix the update_mmu_cache() last argument passing in mm/huge_memory.c

Quoted 8 lines · Catalin Marinas
Quoted 4 lines
Quoted 2 lines

5) void update_mmu_cache(struct vm_area_struct *vma, unsigned long address, pte_t *ptep)

Yes please.

Should we just use a generic (void *) for the last argument or force a cast in mm/huge_memory.c?

Quoted 8 lines

Ralf's point is that transparent huge page code calls update_mmu_cache with a (pmd_t *) as the last argument. This could make sense for THP as it assumes that huge pages can only be created at the pmd level. But that's unlike mm/hugetlb.c which casts huge page types to pte_t, even though on ARM they are implemented at the pmd level.

On ARM (with VIPT caches) update_mmu_cache() is empty like on x86, though a static inline rather than macro.

It's even worse - mm/huge_memory.c is passing a pmd_t, not a pointer so changing the type of update_mmu_cache's 3rd argument alone won't cut it.

This went unnoticed so far because all existing architectures supporting transparent huge pages implement update_mmu_cache() as do { } while (0).

MIPS uses update_mmu_cache() as the hook to deal with cache aliases and pre-faulting a TLB entry. But aliases don't affect small pages and having a separate variant of update_mmu_cache for huge pages will allow some other optimizations. That's minor but it's the argument types that really need to be fixed and because MIPS also implements huge pages at PMD level I'd be happy if we settle on pte_t * for mm/huge_memory.c.

Ralf

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

#12 lore raw

Re: [PATCH 2/3] mm: thp: Fix the update_mmu_cache() last argument passing in mm/huge_memory.c

Hi Ralf,

Quoted 25 lines · Ralf Baechle
Quoted 8 lines · Catalin Marinas
Quoted 4 lines
Quoted 2 lines

5) void update_mmu_cache(struct vm_area_struct *vma, unsigned long address, pte_t *ptep)

Yes please.

Should we just use a generic (void *) for the last argument or force a cast in mm/huge_memory.c?

Quoted 8 lines

Ralf's point is that transparent huge page code calls update_mmu_cache with a (pmd_t *) as the last argument. This could make sense for THP as it assumes that huge pages can only be created at the pmd level. But that's unlike mm/hugetlb.c which casts huge page types to pte_t, even though on ARM they are implemented at the pmd level.

On ARM (with VIPT caches) update_mmu_cache() is empty like on x86, though a static inline rather than macro.

It's even worse - mm/huge_memory.c is passing a pmd_t, not a pointer so changing the type of update_mmu_cache's 3rd argument alone won't cut it.

This went unnoticed so far because all existing architectures supporting transparent huge pages implement update_mmu_cache() as do { } while (0).

Quoted 6 lines

MIPS uses update_mmu_cache() as the hook to deal with cache aliases and pre-faulting a TLB entry. But aliases don't affect small pages and having a separate variant of update_mmu_cache for huge pages will allow some other optimizations. That's minor but it's the argument types that really need to be fixed and because MIPS also implements huge pages at PMD level I'd be happy if we settle on pte_t * for mm/huge_memory.c.

Just to clarify: do you want a cast from pmd_t * to pte_t * or instead copy the hugetlb code and pass ptes around instead of pmds? The latter is pretty invasive...

Will

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

#13 lore raw

Re: [PATCH 2/3] mm: thp: Fix the update_mmu_cache() last argument passing in mm/huge_memory.c

From: Will Deacon <[email protected]>
Date: Thu, 20 Sep 2012 13:44:01 +0100

Quoted 3 lines

Just to clarify: do you want a cast from pmd_t * to pte_t * or instead copy the hugetlb code and pass ptes around instead of pmds? The latter is pretty invasive...

But will be necessary for SPARC64 and POWERPC where the hugetlb entries are encoded at the PTE level.

#14 lore raw

PATCH 3/3 mm: Introduce HAVE_ARCH_TRANSPARENT_HUGEPAGE

In reply to Will Deacon

From: Steve Capper <[email protected]>

Different architectures have slightly different pre-requisites for supporting Transparent Huge Pages. To simplify the layout of mm/Kconfig, a new option HAVE_ARCH_TRANSPARENT_HUGEPAGE is introduced and set in each architecture's Kconfig file (at the moment x86, with ARM being set in a future patch).

---
 arch/x86/Kconfig |    4 ++++
 mm/Kconfig       |    2 +-
 2 files changed, 5 insertions(+), 1 deletions(-)
arch/x86/Kconfig +4 -0
index 8ec3a1a..7decdcf 100644
@@ -1297,6 +1297,10 @@ config ILLEGAL_POINTER_VALUE
        default 0 if X86_32
        default 0xdead000000000000 if X86_64
 
+config HAVE_ARCH_TRANSPARENT_HUGEPAGE
+       def_bool y
+       depends on MMU
+
 source "mm/Kconfig"
 
 config HIGHPTE
mm/Kconfig +1 -1
index d5c8019..3322342 100644
@@ -318,7 +318,7 @@ config NOMMU_INITIAL_TRIM_EXCESS
 
 config TRANSPARENT_HUGEPAGE
 	bool "Transparent Hugepage Support"
-	depends on X86 && MMU
+	depends on HAVE_ARCH_TRANSPARENT_HUGEPAGE
 	select COMPACTION
 	help
 	  Transparent Hugepages allows the kernel to use huge pages and
Signature · 7 lines
1.7.4.1

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Reviewed-by on v1 3/3
#15 lore raw

Re: [PATCH 3/3] mm: Introduce HAVE_ARCH_TRANSPARENT_HUGEPAGE

Quoted 9 lines · Will Deacon

From: Steve Capper <[email protected]>

Different architectures have slightly different pre-requisites for supporting Transparent Huge Pages. To simplify the layout of mm/Kconfig, a new option HAVE_ARCH_TRANSPARENT_HUGEPAGE is introduced and set in each architecture's Kconfig file (at the moment x86, with ARM being set in a future patch).

Quoted 41 lines
---
 arch/x86/Kconfig |    4 ++++
 mm/Kconfig       |    2 +-
 2 files changed, 5 insertions(+), 1 deletions(-)
arch/x86/Kconfig +4 -0
index 8ec3a1a..7decdcf 100644
@@ -1297,6 +1297,10 @@ config ILLEGAL_POINTER_VALUE
        default 0 if X86_32
        default 0xdead000000000000 if X86_64
 
+config HAVE_ARCH_TRANSPARENT_HUGEPAGE
+       def_bool y
+       depends on MMU
+
 source "mm/Kconfig"
 
 config HIGHPTE
mm/Kconfig +1 -1
index d5c8019..3322342 100644
@@ -318,7 +318,7 @@ config NOMMU_INITIAL_TRIM_EXCESS
 
 config TRANSPARENT_HUGEPAGE
 	bool "Transparent Hugepage Support"
-	depends on X86 && MMU
+	depends on HAVE_ARCH_TRANSPARENT_HUGEPAGE
 	select COMPACTION
 	help
 	  Transparent Hugepages allows the kernel to use huge pages and
Signature · 7 lines
1.7.4.1

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Signature · 1 line
 Kirill A. Shutemov
Reviewed-by on v1 3/3
#16 lore raw

Re: [PATCH 3/3] mm: Introduce HAVE_ARCH_TRANSPARENT_HUGEPAGE

In reply to Will Deacon
Quoted 9 lines · Will Deacon

From: Steve Capper <[email protected]>

Different architectures have slightly different pre-requisites for supporting Transparent Huge Pages. To simplify the layout of mm/Kconfig, a new option HAVE_ARCH_TRANSPARENT_HUGEPAGE is introduced and set in each architecture's Kconfig file (at the moment x86, with ARM being set in a future patch).

Makes sense if there are going to be more archs to support THP.

Quoted 36 lines
---
 arch/x86/Kconfig |    4 ++++
 mm/Kconfig       |    2 +-
 2 files changed, 5 insertions(+), 1 deletions(-)
arch/x86/Kconfig +4 -0
index 8ec3a1a..7decdcf 100644
@@ -1297,6 +1297,10 @@ config ILLEGAL_POINTER_VALUE
        default 0 if X86_32
        default 0xdead000000000000 if X86_64
 
+config HAVE_ARCH_TRANSPARENT_HUGEPAGE
+       def_bool y
+       depends on MMU
+
 source "mm/Kconfig"
 
 config HIGHPTE
mm/Kconfig +1 -1
index d5c8019..3322342 100644
@@ -318,7 +318,7 @@ config NOMMU_INITIAL_TRIM_EXCESS
 
 config TRANSPARENT_HUGEPAGE
 	bool "Transparent Hugepage Support"
-	depends on X86 && MMU
+	depends on HAVE_ARCH_TRANSPARENT_HUGEPAGE
 	select COMPACTION
 	help
 	  Transparent Hugepages allows the kernel to use huge pages and
Signature · 1 line
1.7.4.1
Signature · 2 lines
Michal Hocko
SUSE Labs
#17 lore raw

Re: [PATCH 3/3] mm: Introduce HAVE_ARCH_TRANSPARENT_HUGEPAGE

Quoted 1 line · Michal Hocko

Makes sense if there are going to be more archs to support THP.

The tile architecture currently supports it in our in-house tree, though we haven't returned it to the community yet.

Signature · 2 lines
Chris Metcalf, Tilera Corp.
http://www.tilera.com
#18 lore raw

Re: [PATCH 3/3] mm: Introduce HAVE_ARCH_TRANSPARENT_HUGEPAGE

Quoted 5 lines · Chris Metcalf
Quoted 1 line · Michal Hocko

Makes sense if there are going to be more archs to support THP.

The tile architecture currently supports it in our in-house tree, though we haven't returned it to the community yet.

That's a similar situation for AArch64. We hope to post the arm patches pretty soon though, just ironing out some issues with the thp code.

Unfortunately, it looks like there might be one more change to the core code as we don't have hardware page aging and need to manipulate the YOUNG bit explicitly.

Will

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

maintainer
#19 lore raw

Re: [PATCH 3/3] mm: Introduce HAVE_ARCH_TRANSPARENT_HUGEPAGE

In reply to Will Deacon
Quoted 25 lines · On Tue, 11 Sep 2012 17:47:16 +0100 Will Deacon <[email protected]> wrote:

From: Steve Capper <[email protected]>

Different architectures have slightly different pre-requisites for supporting Transparent Huge Pages. To simplify the layout of mm/Kconfig, a new option HAVE_ARCH_TRANSPARENT_HUGEPAGE is introduced and set in each architecture's Kconfig file (at the moment x86, with ARM being set in a future patch).

arch/x86/Kconfig +4 -0
@@ -1297,6 +1297,10 @@ config ILLEGAL_POINTER_VALUE
        default 0 if X86_32
        default 0xdead000000000000 if X86_64
 
+config HAVE_ARCH_TRANSPARENT_HUGEPAGE
+       def_bool y
+       depends on MMU
+
 source "mm/Kconfig"
 
 config HIGHPTE
mm/Kconfig +0 -0
index d5c8019..3322342 100644

mm/Kconfig config NOMMU_INITIAL_TRIM_EXCESS · line 324

Quoted 8 lines
mm/Kconfig +1 -1
@@ -318,7 +318,7 @@ config NOMMU_INITIAL_TRIM_EXCESS
 
 config TRANSPARENT_HUGEPAGE
 	bool "Transparent Hugepage Support"
-	depends on X86 && MMU
+	depends on HAVE_ARCH_TRANSPARENT_HUGEPAGE
 	select COMPACTION
 	help
 	  Transparent Hugepages allows the kernel to use huge pages and

We need to talk with Gerald concerning
http://ozlabs.org/~akpm/mmotm/broken-out/thp-x86-introduce-have_arch_transparent_hugepage.patch

I did this. Please check.

From: Steve Capper <[email protected]>
Subject: mm: introduce HAVE_ARCH_TRANSPARENT_HUGEPAGE

Different architectures have slightly different pre-requisites for supporting Transparent Huge Pages. To simplify the layout of mm/Kconfig, a new option HAVE_ARCH_TRANSPARENT_HUGEPAGE is introduced and set in each architecture's Kconfig file (at the moment x86, with ARM being set in a future patch).

Cc Arnd Bergmann <[email protected]>
Cc Catalin Marinas <[email protected]>
Cc Kirill A. Shutemov <[email protected]>
Cc Michal Hocko <[email protected]>
Cc Gerald Schaefer <[email protected]>
Cc Andrea Arcangeli <[email protected]>

---

 arch/x86/Kconfig |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
arch/x86/Kconfig renamed from arch/x86/Kconfig~mm-introduce-have_arch_transparent_hugepage +4 -1
diff -puN arch/x86/Kconfig~mm-introduce-have_arch_transparent_hugepage arch/x86/Kconfig
@@ -83,7 +83,6 @@ config X86
 	select IRQ_FORCED_THREADING
 	select USE_GENERIC_SMP_HELPERS if SMP
 	select HAVE_BPF_JIT if X86_64
-	select HAVE_ARCH_TRANSPARENT_HUGEPAGE
 	select CLKEVT_I8253
 	select ARCH_HAVE_NMI_SAFE_CMPXCHG
 	select GENERIC_IOMAP
@@ -1330,6 +1329,10 @@ config ILLEGAL_POINTER_VALUE
        default 0 if X86_32
        default 0xdead000000000000 if X86_64
 
+config HAVE_ARCH_TRANSPARENT_HUGEPAGE
+       def_bool y
+       depends on MMU
+
 source "mm/Kconfig"
 
 config HIGHPTE
#20 lore raw

Re: [PATCH 3/3] mm: Introduce HAVE_ARCH_TRANSPARENT_HUGEPAGE

Hi Andrew,

Quoted 20 lines · Andrew Morton

mm/Kconfig config NOMMU_INITIAL_TRIM_EXCESS · line 324

Quoted 13 lines · On Tue, 11 Sep 2012 17:47:16 +0100 Will Deacon <[email protected]> wrote:
mm/Kconfig +1 -1
index d5c8019..3322342 100644
@@ -318,7 +318,7 @@ config NOMMU_INITIAL_TRIM_EXCESS
 
 config TRANSPARENT_HUGEPAGE
 	bool "Transparent Hugepage Support"
-	depends on X86 && MMU
+	depends on HAVE_ARCH_TRANSPARENT_HUGEPAGE
 	select COMPACTION
 	help
 	  Transparent Hugepages allows the kernel to use huge pages and

We need to talk with Gerald concerning
http://ozlabs.org/~akpm/mmotm/broken-out/thp-x86-introduce-have_arch_transparent_hugepage.patch

Quoted 1 line

I did this. Please check.

[...]

We missed Gerald's patch for s390 and, having picked it into our tree, it acts as a drop-in replacement for what we came up with. So I think you can just drop our patch ("mm: Introduce HAVE_ARCH_TRANSPARENT_HUGEPAGE") altogether.

Cheers,

Will

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

#21 lore raw

Re: [PATCH 3/3] mm: Introduce HAVE_ARCH_TRANSPARENT_HUGEPAGE

In reply to Andrew Morton

Hi Andrew,

arch/x86/Kconfig config X86 · line 86

Quoted 9 lines · On Thu, 13 Sep 2012 12:05:14 -0700 Andrew Morton <[email protected]>…

diff -puN arch/x86/Kconfig~mm-introduce-have_arch_transparent_hugepage arch/x86/Kconfig

arch/x86/Kconfig renamed from arch/x86/Kconfig~mm-introduce-have_arch_transparent_hugepage +0 -1
@@ -83,7 +83,6 @@ config X86
 	select IRQ_FORCED_THREADING
 	select USE_GENERIC_SMP_HELPERS if SMP
 	select HAVE_BPF_JIT if X86_64
-	select HAVE_ARCH_TRANSPARENT_HUGEPAGE

Why not
select HAVE_ARCH_TRANSPARENT_HUGEPAGE if MMU

Quoted 11 lines
arch/x86/Kconfig renamed from arch/x86/Kconfig~mm-introduce-have_arch_transparent_hugepage +4 -0
 	select CLKEVT_I8253
 	select ARCH_HAVE_NMI_SAFE_CMPXCHG
 	select GENERIC_IOMAP
@@ -1330,6 +1329,10 @@ config ILLEGAL_POINTER_VALUE
        default 0 if X86_32
        default 0xdead000000000000 if X86_64
 
+config HAVE_ARCH_TRANSPARENT_HUGEPAGE
+       def_bool y
+       depends on MMU
+
Signature · 3 lines
Cheers,
Stephen Rothwell                    [email protected]
http://www.canb.auug.org.au/~sfr/
maintainer
#22 lore raw

Re: [PATCH 3/3] mm: Introduce HAVE_ARCH_TRANSPARENT_HUGEPAGE

Quoted 4 lines · On Fri, 14 Sep 2012 07:27:32 +1000 Stephen Rothwell <[email protected]>…

Hi Andrew,

Quoted 1 line · On Thu, 13 Sep 2012 12:05:14 -0700 Andrew Morton <[email protected]>…
Quoted 12 lines

arch/x86/Kconfig config X86 · line 86

Quoted 8 lines

diff -puN arch/x86/Kconfig~mm-introduce-have_arch_transparent_hugepage arch/x86/Kconfig

arch/x86/Kconfig renamed from arch/x86/Kconfig~mm-introduce-have_arch_transparent_hugepage +0 -1
@@ -83,7 +83,6 @@ config X86
 	select IRQ_FORCED_THREADING
 	select USE_GENERIC_SMP_HELPERS if SMP
 	select HAVE_BPF_JIT if X86_64
-	select HAVE_ARCH_TRANSPARENT_HUGEPAGE

Why not
select HAVE_ARCH_TRANSPARENT_HUGEPAGE if MMU

Well, this is in arch/x86/Kconfig, where MMU is known to always be set.

Yes, I think Gerald's patch will suffice:

arch/Kconfig renamed from arch/Kconfig~thp-x86-introduce-have_arch_transparent_hugepage +3 -0
@@ -326,4 +326,7 @@ config HAVE_RCU_USER_QS
 	  are already protected inside rcu_irq_enter/rcu_irq_exit() but
 	  preemption or signal handling on irq exit still need to be protected.
 
+config HAVE_ARCH_TRANSPARENT_HUGEPAGE
+	bool
+
 source "kernel/gcov/Kconfig"
arch/x86/Kconfig renamed from arch/x86/Kconfig~thp-x86-introduce-have_arch_transparent_hugepage +1 -0
@@ -83,6 +83,7 @@ config X86
 	select IRQ_FORCED_THREADING
 	select USE_GENERIC_SMP_HELPERS if SMP
 	select HAVE_BPF_JIT if X86_64
+	select HAVE_ARCH_TRANSPARENT_HUGEPAGE
 	select CLKEVT_I8253
 	select ARCH_HAVE_NMI_SAFE_CMPXCHG
 	select GENERIC_IOMAP
mm/Kconfig renamed from mm/Kconfig~thp-x86-introduce-have_arch_transparent_hugepage +1 -1
@@ -318,7 +318,7 @@ config NOMMU_INITIAL_TRIM_EXCESS
 
 config TRANSPARENT_HUGEPAGE
 	bool "Transparent Hugepage Support"
-	depends on X86 && MMU
+	depends on HAVE_ARCH_TRANSPARENT_HUGEPAGE
 	select COMPACTION
 	help
 	  Transparent Hugepages allows the kernel to use huge pages and

_

#23 lore raw
In reply to Will Deacon
Quoted 1 line · Will Deacon

Hello,

Hi,

Quoted 8 lines

A few changes are required to common hugetlb code before the ARM support can be merged. I posted the main one previously, which has been picked up by akpm:

http://marc.info/?l=linux-mm&m=134573987631394&w=2

The remaining three patches (included here) are all fairly minor but do affect other architectures.

I am quite confused. Why THP changes are required for hugetlb code for ARM?

Besides that I would suggest adding Andrea to the CC (added now the whole series can be found here http://lkml.org/lkml/2012/9/11/322) list for all THP changes.

Quoted 22 lines

All comments welcome,

Will

Catalin Marinas (2):
mm: thp: Fix the pmd_clear() arguments in pmdp_get_and_clear()
mm: thp: Fix the update_mmu_cache() last argument passing in
mm/huge_memory.c

Steve Capper (1):
mm: Introduce HAVE_ARCH_TRANSPARENT_HUGEPAGE

 arch/x86/Kconfig              |    4 ++++
 include/asm-generic/pgtable.h |    2 +-
 mm/Kconfig                    |    2 +-
 mm/huge_memory.c              |    6 +++---
 4 files changed, 9 insertions(+), 5 deletions(-)
Signature · 1 line
1.7.4.1
Signature · 8 lines
Michal Hocko
SUSE Labs

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
#24 lore raw
Quoted 5 lines · Michal Hocko
Quoted 4 lines · Will Deacon

A few changes are required to common hugetlb code before the ARM support can be merged. I posted the main one previously, which has been picked up by akpm:

Quoted 7 lines
Quoted 4 lines

http://marc.info/?l=linux-mm&m=134573987631394&w=2

The remaining three patches (included here) are all fairly minor but do affect other architectures.

I am quite confused. Why THP changes are required for hugetlb code for ARM?

Sorry, I was being too vague. We add ARM support for THP in the same patch series as hugetlb, so I was loosely referring to that lot.

Quoted 3 lines

Besides that I would suggest adding Andrea to the CC (added now the whole series can be found here http://lkml.org/lkml/2012/9/11/322) list for all THP changes.

Thanks for that, I'll add Andrew to future submissions.

Will

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

#25 lore raw
Quoted 8 lines · Will Deacon
Quoted 7 lines · Michal Hocko
Quoted 6 lines · Will Deacon

A few changes are required to common hugetlb code before the ARM support can be merged. I posted the main one previously, which has been picked up by akpm:

http://marc.info/?l=linux-mm&m=134573987631394&w=2

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

The remaining three patches (included here) are all fairly minor but do affect other architectures.

I am quite confused. Why THP changes are required for hugetlb code for ARM?

Sorry, I was being too vague. We add ARM support for THP in the same patch series as hugetlb, so I was loosely referring to that lot.

OK, it makes more sense now. Thanks for the clarification.

Signature · 2 lines
Michal Hocko
SUSE Labs
Reviewed-by
#26 lore raw
In reply to Michal Hocko

Hi everyone,

Quoted 9 lines · Michal Hocko
Quoted 1 line · Will Deacon

Hello,

Hi,

Quoted 4 lines

A few changes are required to common hugetlb code before the ARM support can be merged. I posted the main one previously, which has been picked up by akpm:

Quoted 7 lines
Quoted 4 lines

http://marc.info/?l=linux-mm&m=134573987631394&w=2

The remaining three patches (included here) are all fairly minor but do affect other architectures.

I am quite confused. Why THP changes are required for hugetlb code for ARM?

Some functions are just noops on x86 and with no arch other than x86 building the huge_memory.c file, those x86-noop parts that needed minor interface adjustments couldn't be noticed until now.

Hopefully we got the brainer part right (i.e. the location of the x86 noop callouts), it's clearly untested.

Quoted 13 lines

Besides that I would suggest adding Andrea to the CC (added now the whole series can be found here http://lkml.org/lkml/2012/9/11/322) list for all THP changes.

Quoted 9 lines

All comments welcome,

Will

Catalin Marinas (2):
mm: thp: Fix the pmd_clear() arguments in pmdp_get_and_clear()
mm: thp: Fix the update_mmu_cache() last argument passing in
mm/huge_memory.c

Both:

Quoted 3 lines
Quoted 3 lines

Steve Capper (1):
mm: Introduce HAVE_ARCH_TRANSPARENT_HUGEPAGE

This was already introduced by the s390 THP support which I reviewed a few days ago, and it's already included in -mm, so it can be dropped.

Thanks!
Andrea

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