[PATCH 3/3] KVM: ARM: Transparent huge pages and hugetlbfs support

Marc Zyngier marc.zyngier at arm.com
Fri Oct 4 05:23:06 EDT 2013


On 2013-10-03 21:33, Christoffer Dall wrote:
> 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?

Indeed. Just keeping you on your toes ;-)

         M.
-- 
Fast, cheap, reliable. Pick two.



More information about the linux-arm-kernel mailing list