linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
To: Anshuman Khandual <khandual@linux.vnet.ibm.com>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	linuxppc-dev@lists.ozlabs.org
Cc: hughd@google.com, kirill@shutemov.name,
	n-horiguchi@ah.jp.nec.com, akpm@linux-foundation.org,
	mgorman@techsingularity.net, mpe@ellerman.id.au
Subject: Re: [RFC 6/9] powerpc/hugetlb: Enable ARCH_WANT_GENERAL_HUGETLB for BOOK3S 64K
Date: Thu, 10 Mar 2016 01:28:48 +0530	[thread overview]
Message-ID: <8760wv1kzr.fsf@linux.vnet.ibm.com> (raw)
In-Reply-To: <1457525450-4262-6-git-send-email-khandual@linux.vnet.ibm.com>

Anshuman Khandual <khandual@linux.vnet.ibm.com> writes:

> [ text/plain ]
> This enables ARCH_WANT_GENERAL_HUGETLB for BOOK3S 64K in Kconfig.
> It also implements a new function 'pte_huge' which is required by
> function 'huge_pte_alloc' from generic VM. Existing BOOK3S 64K
> specific functions 'huge_pte_alloc' and 'huge_pte_offset' (which
> are no longer required) are removed with this change.
>

You want this to be the last patch isn't it ? And you are mixing too
many things in this patch. Why not do this

* book3s specific hash pte routines
* book3s add conditional based on GENERAL_HUGETLB
* Enable GENERAL_HUGETLB for 64k page size config

> Signed-off-by: Anshuman Khandual <khandual@linux.vnet.ibm.com>
> ---
>  arch/powerpc/Kconfig                          |  4 ++
>  arch/powerpc/include/asm/book3s/64/hash-64k.h |  8 ++++
>  arch/powerpc/mm/hugetlbpage.c                 | 60 ---------------------------
>  3 files changed, 12 insertions(+), 60 deletions(-)
>
> diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
> index 9faa18c..c6920bb 100644
> --- a/arch/powerpc/Kconfig
> +++ b/arch/powerpc/Kconfig
> @@ -33,6 +33,10 @@ config HAVE_SETUP_PER_CPU_AREA
>  config NEED_PER_CPU_EMBED_FIRST_CHUNK
>  	def_bool PPC64
>
> +config ARCH_WANT_GENERAL_HUGETLB
> +	depends on PPC_64K_PAGES && PPC_BOOK3S_64
> +	def_bool y
> +
>  config NR_IRQS
>  	int "Number of virtual interrupt numbers"
>  	range 32 32768
> diff --git a/arch/powerpc/include/asm/book3s/64/hash-64k.h b/arch/powerpc/include/asm/book3s/64/hash-64k.h
> index 849bbec..5e9b9b9 100644
> --- a/arch/powerpc/include/asm/book3s/64/hash-64k.h
> +++ b/arch/powerpc/include/asm/book3s/64/hash-64k.h
> @@ -143,6 +143,14 @@ extern bool __rpte_sub_valid(real_pte_t rpte, unsigned long index);
>   * Defined in such a way that we can optimize away code block at build time
>   * if CONFIG_HUGETLB_PAGE=n.
>   */
> +static inline int pte_huge(pte_t pte)
> +{
> +	/*
> +	 * leaf pte for huge page
> +	 */
> +	return !!(pte_val(pte) & _PAGE_PTE);
> +}
> +
>  static inline int pmd_huge(pmd_t pmd)
>  {
>  	/*
> diff --git a/arch/powerpc/mm/hugetlbpage.c b/arch/powerpc/mm/hugetlbpage.c
> index f834a74..f6e4712 100644
> --- a/arch/powerpc/mm/hugetlbpage.c
> +++ b/arch/powerpc/mm/hugetlbpage.c
> @@ -59,42 +59,7 @@ pte_t *huge_pte_offset(struct mm_struct *mm, unsigned long addr)
>  	/* Only called for hugetlbfs pages, hence can ignore THP */
>  	return __find_linux_pte_or_hugepte(mm->pgd, addr, NULL, NULL);
>  }
> -#else
> -pte_t *huge_pte_offset(struct mm_struct *mm, unsigned long addr)
> -{
> -	pgd_t pgd, *pgdp;
> -	pud_t pud, *pudp;
> -	pmd_t pmd, *pmdp;
> -
> -	pgdp = mm->pgd + pgd_index(addr);
> -	pgd  = READ_ONCE(*pgdp);
> -
> -	if (pgd_none(pgd))
> -		return NULL;
> -
> -	if (pgd_huge(pgd))
> -		return (pte_t *)pgdp;
> -
> -	pudp = pud_offset(&pgd, addr);
> -	pud  = READ_ONCE(*pudp);
> -	if (pud_none(pud))
> -		return NULL;
> -
> -	if (pud_huge(pud))
> -		return (pte_t *)pudp;
>
> -	pmdp = pmd_offset(&pud, addr);
> -	pmd  = READ_ONCE(*pmdp);
> -	if (pmd_none(pmd))
> -		return NULL;
> -
> -	if (pmd_huge(pmd))
> -		return (pte_t *)pmdp;
> -	return NULL;
> -}
> -#endif /* !defined(CONFIG_PPC_64K_PAGES) || !defined(CONFIG_PPC_BOOK3S_64) */
> -
> -#if !defined(CONFIG_PPC_64K_PAGES) || !defined(CONFIG_PPC_BOOK3S_64)
>  static int __hugepte_alloc(struct mm_struct *mm, hugepd_t *hpdp,
>  			   unsigned long address, unsigned pdshift, unsigned pshift)
>  {
> @@ -211,31 +176,6 @@ hugepd_search:
>
>  	return hugepte_offset(*hpdp, addr, pdshift);
>  }
> -
> -#else
> -pte_t *huge_pte_alloc(struct mm_struct *mm, unsigned long addr, unsigned long sz)
> -{
> -	pgd_t *pg;
> -	pud_t *pu;
> -	pmd_t *pm;
> -	unsigned pshift = __ffs(sz);
> -
> -	addr &= ~(sz-1);
> -	pg = pgd_offset(mm, addr);
> -
> -	if (pshift == PGDIR_SHIFT)	/* 16GB Huge Page */
> -		return (pte_t *)pg;
> -
> -	pu = pud_alloc(mm, pg, addr);	/* NA, skipped */
> -	if (pshift == PUD_SHIFT)
> -		return (pte_t *)pu;
> -
> -	pm = pmd_alloc(mm, pu, addr);	/* 16MB Huge Page */
> -	if (pshift == PMD_SHIFT)
> -		return (pte_t *)pm;
> -
> -	return NULL;
> -}
>  #endif
>  #else
>
> -- 
> 2.1.0

  reply	other threads:[~2016-03-09 19:59 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-09 12:10 [RFC 1/9] mm/hugetlb: Make GENERAL_HUGETLB functions PGD implementation aware Anshuman Khandual
2016-03-09 12:10 ` [RFC 2/9] mm/hugetlb: Add follow_huge_pgd function Anshuman Khandual
2016-03-11  3:02   ` Anshuman Khandual
2016-03-09 12:10 ` [RFC 3/9] mm/gup: Make follow_page_mask function PGD implementation aware Anshuman Khandual
2016-03-11  3:03   ` Anshuman Khandual
2016-03-09 12:10 ` [RFC 4/9] powerpc/mm: Split huge_pte_alloc function for BOOK3S 64K Anshuman Khandual
2016-03-09 19:55   ` Aneesh Kumar K.V
2016-03-10  5:33     ` Anshuman Khandual
2016-03-09 12:10 ` [RFC 5/9] powerpc/mm: Split huge_pte_offset " Anshuman Khandual
2016-03-09 22:57   ` Dave Hansen
2016-03-10  3:37     ` Anshuman Khandual
2016-03-09 12:10 ` [RFC 6/9] powerpc/hugetlb: Enable ARCH_WANT_GENERAL_HUGETLB " Anshuman Khandual
2016-03-09 19:58   ` Aneesh Kumar K.V [this message]
2016-03-10  5:12     ` Anshuman Khandual
2016-03-21  9:55   ` Rui Teng
2016-03-09 12:10 ` [RFC 7/9] powerpc/hugetlb: Change follow_huge_* routines " Anshuman Khandual
2016-03-09 12:10 ` [RFC 8/9] powerpc/mm: Enable HugeTLB page migration Anshuman Khandual
2016-03-09 12:10 ` [RFC 9/9] selfttest/powerpc: Add memory page migration tests Anshuman Khandual
2016-03-09 20:01   ` Aneesh Kumar K.V
2016-03-10  5:05     ` Anshuman Khandual
2016-03-11  3:01 ` [RFC 1/9] mm/hugetlb: Make GENERAL_HUGETLB functions PGD implementation aware Anshuman Khandual
2016-03-14 20:29   ` Andrew Morton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8760wv1kzr.fsf@linux.vnet.ibm.com \
    --to=aneesh.kumar@linux.vnet.ibm.com \
    --cc=akpm@linux-foundation.org \
    --cc=hughd@google.com \
    --cc=khandual@linux.vnet.ibm.com \
    --cc=kirill@shutemov.name \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mgorman@techsingularity.net \
    --cc=mpe@ellerman.id.au \
    --cc=n-horiguchi@ah.jp.nec.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).