From: catalin.marinas@arm.com (Catalin Marinas)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] arm64: fix pud_huge() for 2-level pagetables
Date: Fri, 16 May 2014 17:20:06 +0100 [thread overview]
Message-ID: <20140516162006.GJ5624@arm.com> (raw)
In-Reply-To: <1400255651.21547.214.camel@deneb.redhat.com>
On Fri, May 16, 2014 at 04:54:11PM +0100, Mark Salter wrote:
> On Fri, 2014-05-16 at 11:04 +0100, Catalin Marinas wrote:
> > On Thu, May 15, 2014 at 03:19:22PM +0100, Mark Salter wrote:
> > > diff --git a/arch/arm64/mm/hugetlbpage.c b/arch/arm64/mm/hugetlbpage.c
> > > index 5e9aec3..9bed38f 100644
> > > --- a/arch/arm64/mm/hugetlbpage.c
> > > +++ b/arch/arm64/mm/hugetlbpage.c
> > > @@ -51,7 +51,11 @@ int pmd_huge(pmd_t pmd)
> > >
> > > int pud_huge(pud_t pud)
> > > {
> > > +#ifndef __PAGETABLE_PMD_FOLDED
> > > return !(pud_val(pud) & PUD_TABLE_BIT);
> > > +#else
> > > + return 0;
> > > +#endif
> > > }
> > >
> > > int pmd_huge_support(void)
> > > @@ -64,8 +68,10 @@ static __init int setup_hugepagesz(char *opt)
> > > unsigned long ps = memparse(opt, &opt);
> > > if (ps == PMD_SIZE) {
> > > hugetlb_add_hstate(PMD_SHIFT - PAGE_SHIFT);
> > > +#ifndef __PAGETABLE_PMD_FOLDED
> > > } else if (ps == PUD_SIZE) {
> > > hugetlb_add_hstate(PUD_SHIFT - PAGE_SHIFT);
> > > +#endif
> >
> > Since PMD_SIZE == PUD_SIZE when __PAGETABLE_PMD_FOLDED, do we need the
> > #ifndef here? Maybe the compiler is smart enough to remove it but it's
> > not on a critical path anyway, so I wouldn't bother.
>
> Yes, I think it would remove it. In any case, one less ifdef would be
> a good thing.
I merged this patch and dropped the last #ifndef.
I still have doubts about the kvm code calling put_page more than
necessary, especially since pud == pmd and the loop continues after
pud_huge() returns true, but your patch looks harmless.
Unless Steve has any objection, I'll push it to mainline. I also added
Cc: stable # v3.11+
Thanks.
--
Catalin
WARNING: multiple messages have this Message-ID (diff)
From: Catalin Marinas <catalin.marinas@arm.com>
To: Mark Salter <msalter@redhat.com>
Cc: Will Deacon <Will.Deacon@arm.com>,
Steve Capper <steve.capper@linaro.org>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] arm64: fix pud_huge() for 2-level pagetables
Date: Fri, 16 May 2014 17:20:06 +0100 [thread overview]
Message-ID: <20140516162006.GJ5624@arm.com> (raw)
In-Reply-To: <1400255651.21547.214.camel@deneb.redhat.com>
On Fri, May 16, 2014 at 04:54:11PM +0100, Mark Salter wrote:
> On Fri, 2014-05-16 at 11:04 +0100, Catalin Marinas wrote:
> > On Thu, May 15, 2014 at 03:19:22PM +0100, Mark Salter wrote:
> > > diff --git a/arch/arm64/mm/hugetlbpage.c b/arch/arm64/mm/hugetlbpage.c
> > > index 5e9aec3..9bed38f 100644
> > > --- a/arch/arm64/mm/hugetlbpage.c
> > > +++ b/arch/arm64/mm/hugetlbpage.c
> > > @@ -51,7 +51,11 @@ int pmd_huge(pmd_t pmd)
> > >
> > > int pud_huge(pud_t pud)
> > > {
> > > +#ifndef __PAGETABLE_PMD_FOLDED
> > > return !(pud_val(pud) & PUD_TABLE_BIT);
> > > +#else
> > > + return 0;
> > > +#endif
> > > }
> > >
> > > int pmd_huge_support(void)
> > > @@ -64,8 +68,10 @@ static __init int setup_hugepagesz(char *opt)
> > > unsigned long ps = memparse(opt, &opt);
> > > if (ps == PMD_SIZE) {
> > > hugetlb_add_hstate(PMD_SHIFT - PAGE_SHIFT);
> > > +#ifndef __PAGETABLE_PMD_FOLDED
> > > } else if (ps == PUD_SIZE) {
> > > hugetlb_add_hstate(PUD_SHIFT - PAGE_SHIFT);
> > > +#endif
> >
> > Since PMD_SIZE == PUD_SIZE when __PAGETABLE_PMD_FOLDED, do we need the
> > #ifndef here? Maybe the compiler is smart enough to remove it but it's
> > not on a critical path anyway, so I wouldn't bother.
>
> Yes, I think it would remove it. In any case, one less ifdef would be
> a good thing.
I merged this patch and dropped the last #ifndef.
I still have doubts about the kvm code calling put_page more than
necessary, especially since pud == pmd and the loop continues after
pud_huge() returns true, but your patch looks harmless.
Unless Steve has any objection, I'll push it to mainline. I also added
Cc: stable # v3.11+
Thanks.
--
Catalin
next prev parent reply other threads:[~2014-05-16 16:20 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-15 14:19 [PATCH] arm64: fix pud_huge() for 2-level pagetables Mark Salter
2014-05-15 14:19 ` Mark Salter
2014-05-15 14:44 ` Steve Capper
2014-05-15 14:44 ` Steve Capper
2014-05-15 16:27 ` Mark Salter
2014-05-15 16:27 ` Mark Salter
2014-05-15 17:55 ` Steve Capper
2014-05-15 17:55 ` Steve Capper
2014-05-15 18:39 ` Mark Salter
2014-05-15 18:39 ` Mark Salter
2014-05-16 9:51 ` Catalin Marinas
2014-05-16 9:51 ` Catalin Marinas
2014-05-16 10:04 ` Catalin Marinas
2014-05-16 10:04 ` Catalin Marinas
2014-05-16 15:54 ` Mark Salter
2014-05-16 15:54 ` Mark Salter
2014-05-16 16:20 ` Catalin Marinas [this message]
2014-05-16 16:20 ` Catalin Marinas
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=20140516162006.GJ5624@arm.com \
--to=catalin.marinas@arm.com \
--cc=linux-arm-kernel@lists.infradead.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.