All of lore.kernel.org
 help / color / mirror / Atom feed
From: christoffer.dall@linaro.org (Christoffer Dall)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 3/3] KVM: ARM: Transparent huge pages and hugetlbfs support
Date: Thu, 3 Oct 2013 13:33:52 -0700	[thread overview]
Message-ID: <20131003203352.GE5108@cbox> (raw)
In-Reply-To: <524013BB.4090303@arm.com>

On Mon, Sep 23, 2013 at 11:11:07AM +0100, Marc Zyngier wrote:

[...]

> > 
> > +static bool transparent_hugepage_adjust(pfn_t *pfnp, phys_addr_t *ipap)
> > +{
> > +       pfn_t pfn = *pfnp;
> > +       gfn_t gfn = *ipap >> PAGE_SHIFT;
> > +
> > +       if (PageTransCompound(pfn_to_page(pfn))) {
> > +               unsigned long mask;
> > +               /*
> > +                * mmu_notifier_retry was successful and we hold the
> > +                * mmu_lock here, so the pmd can't become splitting
> > +                * from under us, and in turn
> > +                * __split_huge_page_refcount() can't run from under
> > +                * us and we can safely transfer the refcount from
> > +                * PG_tail to PG_head as we switch the pfn from tail to
> > +                * head.
> > +                */
> 
> -ECANTPARSE. Well, I sort of can, but this deserves a clearer explanation.
> 
> > +               mask = (PMD_SIZE / PAGE_SIZE) - 1;
> 
> 		mask = PTRS_PER_PMD -1;
> 
> > +               VM_BUG_ON((gfn & mask) != (pfn & mask));
> > +               if (pfn & mask) {
> > +                       gfn &= ~mask;
> 
> This doesn't seem to be used later on.
> 
> > +                       *ipap &= ~(PMD_SIZE - 1);
> 
> 			*ipap &= ~PMD_MASK;
> 
damn, I trust you too much, you surely meant
			*ipap &= PMD_MASK;

right?

> > +                       kvm_release_pfn_clean(pfn);
> > +                       pfn &= ~mask;
> > +                       kvm_get_pfn(pfn);
> > +                       *pfnp = pfn;
> > +               }
> 
> 
> 
> > +               return true;
> > +       }
> > +
> > +       return false;
> > +}
> > +

-Christoffer

WARNING: multiple messages have this Message-ID (diff)
From: Christoffer Dall <christoffer.dall@linaro.org>
To: Marc Zyngier <marc.zyngier@arm.com>
Cc: "kvmarm@lists.cs.columbia.edu" <kvmarm@lists.cs.columbia.edu>,
	"kvm@vger.kernel.org" <kvm@vger.kernel.org>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	"linaro-kernel@lists.linaro.org" <linaro-kernel@lists.linaro.org>,
	"patches@linaro.org" <patches@linaro.org>,
	Christoffer Dall <cdall@cs.columbia.edu>
Subject: Re: [PATCH 3/3] KVM: ARM: Transparent huge pages and hugetlbfs support
Date: Thu, 3 Oct 2013 13:33:52 -0700	[thread overview]
Message-ID: <20131003203352.GE5108@cbox> (raw)
In-Reply-To: <524013BB.4090303@arm.com>

On Mon, Sep 23, 2013 at 11:11:07AM +0100, Marc Zyngier wrote:

[...]

> > 
> > +static bool transparent_hugepage_adjust(pfn_t *pfnp, phys_addr_t *ipap)
> > +{
> > +       pfn_t pfn = *pfnp;
> > +       gfn_t gfn = *ipap >> PAGE_SHIFT;
> > +
> > +       if (PageTransCompound(pfn_to_page(pfn))) {
> > +               unsigned long mask;
> > +               /*
> > +                * mmu_notifier_retry was successful and we hold the
> > +                * mmu_lock here, so the pmd can't become splitting
> > +                * from under us, and in turn
> > +                * __split_huge_page_refcount() can't run from under
> > +                * us and we can safely transfer the refcount from
> > +                * PG_tail to PG_head as we switch the pfn from tail to
> > +                * head.
> > +                */
> 
> -ECANTPARSE. Well, I sort of can, but this deserves a clearer explanation.
> 
> > +               mask = (PMD_SIZE / PAGE_SIZE) - 1;
> 
> 		mask = PTRS_PER_PMD -1;
> 
> > +               VM_BUG_ON((gfn & mask) != (pfn & mask));
> > +               if (pfn & mask) {
> > +                       gfn &= ~mask;
> 
> This doesn't seem to be used later on.
> 
> > +                       *ipap &= ~(PMD_SIZE - 1);
> 
> 			*ipap &= ~PMD_MASK;
> 
damn, I trust you too much, you surely meant
			*ipap &= PMD_MASK;

right?

> > +                       kvm_release_pfn_clean(pfn);
> > +                       pfn &= ~mask;
> > +                       kvm_get_pfn(pfn);
> > +                       *pfnp = pfn;
> > +               }
> 
> 
> 
> > +               return true;
> > +       }
> > +
> > +       return false;
> > +}
> > +

-Christoffer

  parent reply	other threads:[~2013-10-03 20:33 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-09  4:07 [PATCH 0/3] KVM/ARM Huge pages support Christoffer Dall
2013-08-09  4:07 ` Christoffer Dall
2013-08-09  4:07 ` [PATCH 1/3] KVM: Move gfn_to_index to x86 specific code Christoffer Dall
2013-08-09  4:07   ` Christoffer Dall
2013-08-09  4:07 ` [PATCH 2/3] KVM: ARM: Get rid of KVM_HPAGE_XXX defines Christoffer Dall
2013-08-09  4:07   ` Christoffer Dall
2013-08-09  4:07 ` [PATCH 3/3] KVM: ARM: Transparent huge pages and hugetlbfs support Christoffer Dall
2013-08-09  4:07   ` Christoffer Dall
2013-09-23 10:11   ` Marc Zyngier
2013-09-23 10:11     ` Marc Zyngier
2013-09-23 14:46     ` Marc Zyngier
2013-09-23 14:46       ` Marc Zyngier
2013-09-24 15:41     ` Steve Capper
2013-09-24 15:41       ` Steve Capper
2013-10-02 22:36     ` Christoffer Dall
2013-10-02 22:36       ` Christoffer Dall
2013-10-03 20:33     ` Christoffer Dall [this message]
2013-10-03 20:33       ` Christoffer Dall
2013-10-04  9:23       ` Marc Zyngier
2013-10-04  9:23         ` Marc Zyngier
2013-08-09 14:30 ` [PATCH 2/3] KVM: ARM: Get rid of KVM_HPAGE_ defines Christoffer Dall
2013-08-09 14:30   ` Christoffer Dall
2013-08-25 14:05   ` Gleb Natapov
2013-08-25 14:05     ` Gleb Natapov
2013-08-25 14:29     ` Peter Maydell
2013-08-25 14:29       ` Peter Maydell
2013-08-25 14:48       ` Gleb Natapov
2013-08-25 14:48         ` Gleb Natapov
2013-08-25 15:18         ` Peter Maydell
2013-08-25 15:18           ` Peter Maydell
2013-08-25 15:27           ` Alexander Graf
2013-08-25 15:27             ` Alexander Graf
2013-08-26 10:55             ` Gleb Natapov
2013-08-26 10:55               ` Gleb Natapov
2013-08-26  0:46           ` Christoffer Dall
2013-08-26  0:46             ` Christoffer Dall

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=20131003203352.GE5108@cbox \
    --to=christoffer.dall@linaro.org \
    --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.