mm/hugetlb: reduce arch dependent code about huge_pmd_unshare
Subsystems (10)
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH 1/1 mm/hugetlb: reduce arch dependent code about huge_pmd_unshare
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.
--- 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(-)
arch/arm/mm/hugetlbpage.c +0 -5
@@ -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 );
arch/arm64/mm/hugetlbpage.c +0 -7
@@ -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 );
arch/ia64/mm/hugetlbpage.c +0 -5
@@ -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; }/*
arch/metag/mm/hugetlbpage.c +0 -5
@@ -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 ;
arch/mips/mm/hugetlbpage.c +0 -5
@@ -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. */
arch/powerpc/mm/hugetlbpage.c +0 -5
@@ -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))
arch/s390/mm/hugetlbpage.c +0 -5
@@ -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 )
arch/sh/mm/hugetlbpage.c +0 -5
@@ -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 ;
arch/sparc/mm/hugetlbpage.c +0 -5
@@ -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) {
arch/tile/mm/hugetlbpage.c +0 -5
@@ -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,
mm/hugetlb.c +5 -0
@@ -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 */
Signature · 13 lines
1.9.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>
Andrew Morton
maintainerQuoted 6 lines · On Tue, 14 Apr 2015 15:35:04 +0800 Zhang Zhen <[email protected]>…
Currently we have many duplicates in definitions of
huge_pmd_unshare. In all architectures this function just returns 0 whenCONFIG_ARCH_WANT_HUGE_PMD_SHAREis N.This patch put the default implementation in
mm/hugetlb.cand 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 [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>
Quoted 3 lines
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 [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>
Andrew Morton
maintainerQuoted 6 lines · Tony
Quoted 3 lines
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_64and 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 [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>
Hi,
Quoted 11 lines · Andrew Morton
Quoted 6 lines · Tony
Quoted 3 lines
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_64and then spread to arm*.Yes. In
3212b535f200c85b5a6Steve 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.
Quoted 4 lines
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,
Signature · 7 lines
Steve -- 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>