linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm/hugetlb: reduce arch dependent code about huge_pmd_unshare
       [not found] <1428996566-86763-1-git-send-email-zhenzhang.zhang@huawei.com>
@ 2015-04-14  7:35 ` Zhang Zhen
  2015-04-23 22:11   ` Andrew Morton
  0 siblings, 1 reply; 5+ messages in thread
From: Zhang Zhen @ 2015-04-14  7:35 UTC (permalink / raw)
  To: Linux MM, Linux Kernel Mailing List
  Cc: Andrew Morton, linux, catalin.marinas, tony.luck, james.hogan,
	ralf, benh, schwidefsky, cmetcalf, David Rientjes, James.Yang,
	aneesh.kumar

Currently we have many duplicates in definitions of huge_pmd_unshare.
In all architectures this function just returns 0 when
CONFIG_ARCH_WANT_HUGE_PMD_SHARE is N.

This patch put the default implementation in mm/hugetlb.c and lets
these architecture use the common code.

Signed-off-by: Zhang Zhen <zhenzhang.zhang@huawei.com>
---
 arch/arm/mm/hugetlbpage.c     | 5 -----
 arch/arm64/mm/hugetlbpage.c   | 7 -------
 arch/ia64/mm/hugetlbpage.c    | 5 -----
 arch/metag/mm/hugetlbpage.c   | 5 -----
 arch/mips/mm/hugetlbpage.c    | 5 -----
 arch/powerpc/mm/hugetlbpage.c | 5 -----
 arch/s390/mm/hugetlbpage.c    | 5 -----
 arch/sh/mm/hugetlbpage.c      | 5 -----
 arch/sparc/mm/hugetlbpage.c   | 5 -----
 arch/tile/mm/hugetlbpage.c    | 5 -----
 mm/hugetlb.c                  | 5 +++++
 11 files changed, 5 insertions(+), 52 deletions(-)

diff --git a/arch/arm/mm/hugetlbpage.c b/arch/arm/mm/hugetlbpage.c
index c724124..fcafb52 100644
--- a/arch/arm/mm/hugetlbpage.c
+++ b/arch/arm/mm/hugetlbpage.c
@@ -41,11 +41,6 @@ int pud_huge(pud_t pud)
 	return 0;
 }

-int huge_pmd_unshare(struct mm_struct *mm, unsigned long *addr, pte_t *ptep)
-{
-	return 0;
-}
-
 int pmd_huge(pmd_t pmd)
 {
 	return pmd_val(pmd) && !(pmd_val(pmd) & PMD_TABLE_BIT);
diff --git a/arch/arm64/mm/hugetlbpage.c b/arch/arm64/mm/hugetlbpage.c
index 2de9d2e..cccc4af 100644
--- a/arch/arm64/mm/hugetlbpage.c
+++ b/arch/arm64/mm/hugetlbpage.c
@@ -31,13 +31,6 @@
 #include <asm/tlbflush.h>
 #include <asm/pgalloc.h>

-#ifndef CONFIG_ARCH_WANT_HUGE_PMD_SHARE
-int huge_pmd_unshare(struct mm_struct *mm, unsigned long *addr, pte_t *ptep)
-{
-	return 0;
-}
-#endif
-
 int pmd_huge(pmd_t pmd)
 {
 	return !(pmd_val(pmd) & PMD_TABLE_BIT);
diff --git a/arch/ia64/mm/hugetlbpage.c b/arch/ia64/mm/hugetlbpage.c
index 52b7604..f50d4b3 100644
--- a/arch/ia64/mm/hugetlbpage.c
+++ b/arch/ia64/mm/hugetlbpage.c
@@ -65,11 +65,6 @@ huge_pte_offset (struct mm_struct *mm, unsigned long addr)
 	return pte;
 }

-int huge_pmd_unshare(struct mm_struct *mm, unsigned long *addr, pte_t *ptep)
-{
-	return 0;
-}
-
 #define mk_pte_huge(entry) { pte_val(entry) |= _PAGE_P; }

 /*
diff --git a/arch/metag/mm/hugetlbpage.c b/arch/metag/mm/hugetlbpage.c
index 7ca80ac..53f0f6c 100644
--- a/arch/metag/mm/hugetlbpage.c
+++ b/arch/metag/mm/hugetlbpage.c
@@ -89,11 +89,6 @@ pte_t *huge_pte_offset(struct mm_struct *mm, unsigned long addr)
 	return pte;
 }

-int huge_pmd_unshare(struct mm_struct *mm, unsigned long *addr, pte_t *ptep)
-{
-	return 0;
-}
-
 int pmd_huge(pmd_t pmd)
 {
 	return pmd_page_shift(pmd) > PAGE_SHIFT;
diff --git a/arch/mips/mm/hugetlbpage.c b/arch/mips/mm/hugetlbpage.c
index 06e0f42..74aa6f6 100644
--- a/arch/mips/mm/hugetlbpage.c
+++ b/arch/mips/mm/hugetlbpage.c
@@ -51,11 +51,6 @@ pte_t *huge_pte_offset(struct mm_struct *mm, unsigned long addr)
 	return (pte_t *) pmd;
 }

-int huge_pmd_unshare(struct mm_struct *mm, unsigned long *addr, pte_t *ptep)
-{
-	return 0;
-}
-
 /*
  * This function checks for proper alignment of input addr and len parameters.
  */
diff --git a/arch/powerpc/mm/hugetlbpage.c b/arch/powerpc/mm/hugetlbpage.c
index 7e408bf..dde6ff5 100644
--- a/arch/powerpc/mm/hugetlbpage.c
+++ b/arch/powerpc/mm/hugetlbpage.c
@@ -439,11 +439,6 @@ int alloc_bootmem_huge_page(struct hstate *hstate)
 }
 #endif

-int huge_pmd_unshare(struct mm_struct *mm, unsigned long *addr, pte_t *ptep)
-{
-	return 0;
-}
-
 #ifdef CONFIG_PPC_FSL_BOOK3E
 #define HUGEPD_FREELIST_SIZE \
 	((PAGE_SIZE - sizeof(struct hugepd_freelist)) / sizeof(pte_t))
diff --git a/arch/s390/mm/hugetlbpage.c b/arch/s390/mm/hugetlbpage.c
index 210ffed..fa6e1bc 100644
--- a/arch/s390/mm/hugetlbpage.c
+++ b/arch/s390/mm/hugetlbpage.c
@@ -187,11 +187,6 @@ pte_t *huge_pte_offset(struct mm_struct *mm, unsigned long addr)
 	return (pte_t *) pmdp;
 }

-int huge_pmd_unshare(struct mm_struct *mm, unsigned long *addr, pte_t *ptep)
-{
-	return 0;
-}
-
 int pmd_huge(pmd_t pmd)
 {
 	if (!MACHINE_HAS_HPAGE)
diff --git a/arch/sh/mm/hugetlbpage.c b/arch/sh/mm/hugetlbpage.c
index 534bc97..6385f60 100644
--- a/arch/sh/mm/hugetlbpage.c
+++ b/arch/sh/mm/hugetlbpage.c
@@ -62,11 +62,6 @@ pte_t *huge_pte_offset(struct mm_struct *mm, unsigned long addr)
 	return pte;
 }

-int huge_pmd_unshare(struct mm_struct *mm, unsigned long *addr, pte_t *ptep)
-{
-	return 0;
-}
-
 int pmd_huge(pmd_t pmd)
 {
 	return 0;
diff --git a/arch/sparc/mm/hugetlbpage.c b/arch/sparc/mm/hugetlbpage.c
index 4242eab..131eaf4 100644
--- a/arch/sparc/mm/hugetlbpage.c
+++ b/arch/sparc/mm/hugetlbpage.c
@@ -172,11 +172,6 @@ pte_t *huge_pte_offset(struct mm_struct *mm, unsigned long addr)
 	return pte;
 }

-int huge_pmd_unshare(struct mm_struct *mm, unsigned long *addr, pte_t *ptep)
-{
-	return 0;
-}
-
 void set_huge_pte_at(struct mm_struct *mm, unsigned long addr,
 		     pte_t *ptep, pte_t entry)
 {
diff --git a/arch/tile/mm/hugetlbpage.c b/arch/tile/mm/hugetlbpage.c
index 8416240..c034dc3 100644
--- a/arch/tile/mm/hugetlbpage.c
+++ b/arch/tile/mm/hugetlbpage.c
@@ -160,11 +160,6 @@ int pud_huge(pud_t pud)
 	return !!(pud_val(pud) & _PAGE_HUGE_PAGE);
 }

-int huge_pmd_unshare(struct mm_struct *mm, unsigned long *addr, pte_t *ptep)
-{
-	return 0;
-}
-
 #ifdef HAVE_ARCH_HUGETLB_UNMAPPED_AREA
 static unsigned long hugetlb_get_unmapped_area_bottomup(struct file *file,
 		unsigned long addr, unsigned long len,
diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index c41b2a0..df677142 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -3659,6 +3659,11 @@ pte_t *huge_pmd_share(struct mm_struct *mm, unsigned long addr, pud_t *pud)
 {
 	return NULL;
 }
+
+int huge_pmd_unshare(struct mm_struct *mm, unsigned long *addr, pte_t *ptep)
+{
+	return 0;
+}
 #define want_pmd_share()	(0)
 #endif /* CONFIG_ARCH_WANT_HUGE_PMD_SHARE */

-- 
1.9.1


.




--
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] 5+ messages in thread

* Re: [PATCH] mm/hugetlb: reduce arch dependent code about huge_pmd_unshare
  2015-04-14  7:35 ` [PATCH] mm/hugetlb: reduce arch dependent code about huge_pmd_unshare Zhang Zhen
@ 2015-04-23 22:11   ` Andrew Morton
  2015-04-23 22:26     ` Luck, Tony
  0 siblings, 1 reply; 5+ messages in thread
From: Andrew Morton @ 2015-04-23 22:11 UTC (permalink / raw)
  To: Zhang Zhen
  Cc: Linux MM, Linux Kernel Mailing List, linux, catalin.marinas,
	tony.luck, james.hogan, ralf, benh, schwidefsky, cmetcalf,
	David Rientjes, James.Yang, aneesh.kumar

On Tue, 14 Apr 2015 15:35:04 +0800 Zhang Zhen <zhenzhang.zhang@huawei.com> wrote:

> Currently we have many duplicates in definitions of huge_pmd_unshare.
> In all architectures this function just returns 0 when
> CONFIG_ARCH_WANT_HUGE_PMD_SHARE is N.
> 
> This patch put the default implementation in mm/hugetlb.c and lets
> these architecture use the common code.

Memory fails me.  Why do some architectures (arm, arm64, x86_64) want
huge_pmd_[un]share() while other architectures (ia64, tile, mips,
powerpc, metag, sh, s390) do not?

--
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] 5+ messages in thread

* RE: [PATCH] mm/hugetlb: reduce arch dependent code about huge_pmd_unshare
  2015-04-23 22:11   ` Andrew Morton
@ 2015-04-23 22:26     ` Luck, Tony
  2015-04-23 22:41       ` Andrew Morton
  0 siblings, 1 reply; 5+ messages in thread
From: Luck, Tony @ 2015-04-23 22:26 UTC (permalink / raw)
  To: Andrew Morton, Zhang Zhen
  Cc: Linux MM, Linux Kernel Mailing List, linux, catalin.marinas,
	james.hogan, ralf, benh, schwidefsky, cmetcalf, David Rientjes,
	James.Yang, aneesh.kumar

> Memory fails me.  Why do some architectures (arm, arm64, x86_64) want
> huge_pmd_[un]share() while other architectures (ia64, tile, mips,
> powerpc, metag, sh, s390) do not?

Potentially laziness/ignorance-of-feature?  It looks like this feature started on x86_64 and then spread
to arm*.

Huge pages are weird on ia64 in that they have to be in a specific range of virtual addresses (region 4).
But I don't see why that would prevent sharing pmd's.

-Tony

--
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] 5+ messages in thread

* Re: [PATCH] mm/hugetlb: reduce arch dependent code about huge_pmd_unshare
  2015-04-23 22:26     ` Luck, Tony
@ 2015-04-23 22:41       ` Andrew Morton
  2015-04-24 15:46         ` Steve Capper
  0 siblings, 1 reply; 5+ messages in thread
From: Andrew Morton @ 2015-04-23 22:41 UTC (permalink / raw)
  To: Luck, Tony
  Cc: Zhang Zhen, Linux MM, Linux Kernel Mailing List, linux,
	catalin.marinas, james.hogan, ralf, benh, schwidefsky, cmetcalf,
	David Rientjes, James.Yang, aneesh.kumar

On Thu, 23 Apr 2015 22:26:18 +0000 "Luck, Tony" <tony.luck@intel.com> wrote:

> > Memory fails me.  Why do some architectures (arm, arm64, x86_64) want
> > huge_pmd_[un]share() while other architectures (ia64, tile, mips,
> > powerpc, metag, sh, s390) do not?
> 
> Potentially laziness/ignorance-of-feature?  It looks like this feature started on x86_64 and then spread
> to arm*.

Yes.  In 3212b535f200c85b5a6 Steve Capper (ARM person) hoisted the code
out of x86 into generic, then made arm use it.

We're not (I'm not) very good about letting arch people know about such
things.  I wonder how to fix that; does linux-arch work?

--
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] 5+ messages in thread

* Re: [PATCH] mm/hugetlb: reduce arch dependent code about huge_pmd_unshare
  2015-04-23 22:41       ` Andrew Morton
@ 2015-04-24 15:46         ` Steve Capper
  0 siblings, 0 replies; 5+ messages in thread
From: Steve Capper @ 2015-04-24 15:46 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Luck, Tony, Zhang Zhen, Linux MM, Linux Kernel Mailing List,
	linux, catalin.marinas, james.hogan, ralf, benh, schwidefsky,
	cmetcalf, David Rientjes, James.Yang, aneesh.kumar

Hi,

On 23 April 2015 at 23:41, Andrew Morton <akpm@linux-foundation.org> wrote:
> On Thu, 23 Apr 2015 22:26:18 +0000 "Luck, Tony" <tony.luck@intel.com> wrote:
>
>> > Memory fails me.  Why do some architectures (arm, arm64, x86_64) want
>> > huge_pmd_[un]share() while other architectures (ia64, tile, mips,
>> > powerpc, metag, sh, s390) do not?
>>
>> Potentially laziness/ignorance-of-feature?  It looks like this feature started on x86_64 and then spread
>> to arm*.
>
> Yes.  In 3212b535f200c85b5a6 Steve Capper (ARM person) hoisted the code
> out of x86 into generic, then made arm use it.

I tested the pmd sharing code that x86 had and it worked well on ARM
too so I bundled it in when I generalised some of the huge page code.
I didn't know enough about the other architectures to enable it for
them, so played things safe by leaving it disabled for them.
Looking at this patch, I could have done that more cleanly though.

>
> We're not (I'm not) very good about letting arch people know about such
> things.  I wonder how to fix that; does linux-arch work?
>

linux-arch is working for me, maybe a good idea to CC in some arch
maintainers too.

Cheers,
-- 
Steve

--
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] 5+ messages in thread

end of thread, other threads:[~2015-04-24 15:46 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <1428996566-86763-1-git-send-email-zhenzhang.zhang@huawei.com>
2015-04-14  7:35 ` [PATCH] mm/hugetlb: reduce arch dependent code about huge_pmd_unshare Zhang Zhen
2015-04-23 22:11   ` Andrew Morton
2015-04-23 22:26     ` Luck, Tony
2015-04-23 22:41       ` Andrew Morton
2015-04-24 15:46         ` Steve Capper

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