public inbox for linuxppc-dev@ozlabs.org 
 help / color / mirror / Atom feed
From: Scott Wood <oss@buserror•net>
To: Christophe Leroy <christophe.leroy@c-s•fr>,
	Benjamin Herrenschmidt <benh@kernel•crashing.org>,
	Paul Mackerras <paulus@samba•org>,
	Michael Ellerman <mpe@ellerman•id.au>
Cc: linux-kernel@vger•kernel.org, linuxppc-dev@lists•ozlabs.org
Subject: Re: [PATCH v3 2/3] powerpc: get hugetlbpage handling more generic
Date: Mon, 05 Dec 2016 19:18:36 -0600	[thread overview]
Message-ID: <1480987116.32531.17.camel@buserror.net> (raw)
In-Reply-To: <69b1226ce134761fd7ab81a498bdb85cd737280f.1474441302.git.christophe.leroy@c-s.fr>

On Wed, 2016-09-21 at 10:11 +0200, Christophe Leroy wrote:
> Today there are two implementations of hugetlbpages which are managed
> by exclusive #ifdefs:
> * FSL_BOOKE: several directory entries points to the same single hugepage
> * BOOK3S: one upper level directory entry points to a table of hugepages
> 
> In preparation of implementation of hugepage support on the 8xx, we
> need a mix of the two above solutions, because the 8xx needs both cases
> depending on the size of pages:
> * In 4k page size mode, each PGD entry covers a 4M bytes area. It means
> that 2 PGD entries will be necessary to cover an 8M hugepage while a
> single PGD entry will cover 8x 512k hugepages.
> * In 16 page size mode, each PGD entry covers a 64M bytes area. It means
> that 8x 8M hugepages will be covered by one PGD entry and 64x 512k
> hugepages will be covers by one PGD entry.
> 
> This patch:
> * removes #ifdefs in favor of if/else based on the range sizes
> * merges the two huge_pte_alloc() functions as they are pretty similar
> * merges the two hugetlbpage_init() functions as they are pretty similar
[snip]
> @@ -860,16 +803,34 @@ static int __init hugetlbpage_init(void)
>  		 * if we have pdshift and shift value same, we don't
>  		 * use pgt cache for hugepd.
>  		 */
> -		if (pdshift != shift) {
> +		if (pdshift > shift) {
>  			pgtable_cache_add(pdshift - shift, NULL);
>  			if (!PGT_CACHE(pdshift - shift))
>  				panic("hugetlbpage_init(): could not create
> "
>  				      "pgtable cache for %d bit
> pagesize\n", shift);
>  		}
> +#ifdef CONFIG_PPC_FSL_BOOK3E
> +		else if (!hugepte_cache) {

This else never triggers on book3e, because the way this function calculates
pdshift is wrong for book3e (it uses PyD_SHIFT instead of HUGEPD_PxD_SHIFT).
 We later get OOMs because huge_pte_alloc() calculates pdshift correctly,
tries to use hugepte_cache, and fails.

If the point of this patch is to remove the compile-time decision on whether
to do things the book3e way, why are there still ifdefs such as the ones
controlling the definition of HUGEPD_PxD_SHIFT?  How does what you're doing on
8xx (for certain page sizes) differ from book3e?

-Scott

  parent reply	other threads:[~2016-12-06  1:18 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-21  8:11 [PATCH v3 0/3] powerpc: implementation of huge pages for 8xx Christophe Leroy
2016-09-21  8:11 ` [PATCH v3 1/3] powerpc: port 64 bits pgtable_cache to 32 bits Christophe Leroy
2016-09-22  7:27   ` Aneesh Kumar K.V
2016-09-21  8:11 ` [PATCH v3 2/3] powerpc: get hugetlbpage handling more generic Christophe Leroy
2016-09-21 16:58   ` Aneesh Kumar K.V
2016-11-24  5:23   ` [v3,2/3] " Scott Wood
2016-11-25  8:14     ` Christophe LEROY
2016-12-05  2:58       ` Scott Wood
2016-12-06  1:18   ` Scott Wood [this message]
2016-12-06  6:34     ` [PATCH v3 2/3] " Christophe LEROY
2016-12-07  1:06       ` Scott Wood
2016-12-07  6:59         ` Christophe LEROY
2016-09-21  8:11 ` [PATCH v3 3/3] powerpc/8xx: Implement support of hugepages Christophe Leroy
2016-09-21 16:58   ` Aneesh Kumar K.V

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=1480987116.32531.17.camel@buserror.net \
    --to=oss@buserror$(echo .)net \
    --cc=benh@kernel$(echo .)crashing.org \
    --cc=christophe.leroy@c-s$(echo .)fr \
    --cc=linux-kernel@vger$(echo .)kernel.org \
    --cc=linuxppc-dev@lists$(echo .)ozlabs.org \
    --cc=mpe@ellerman$(echo .)id.au \
    --cc=paulus@samba$(echo .)org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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