WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] Re: [PATCH 2/9] mm: add apply_to_page_range_batch()

To: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>
Subject: [Xen-devel] Re: [PATCH 2/9] mm: add apply_to_page_range_batch()
From: Jeremy Fitzhardinge <jeremy@xxxxxxxx>
Date: Wed, 12 Jan 2011 13:15:26 +1100
Cc: Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxx>, Nick Piggin <npiggin@xxxxxxxxx>, Haavard Skinnemoen <hskinnemoen@xxxxxxxxx>, Linux Kernel Mailing List <linux-kernel@xxxxxxxxxxxxxxx>, Linux-MM <linux-mm@xxxxxxxxx>, Jeremy Fitzhardinge <jeremy.fitzhardinge@xxxxxxxxxx>, Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
Delivery-date: Tue, 11 Jan 2011 18:16:33 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <20110110212628.GC15016@xxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <cover.1292450600.git.jeremy.fitzhardinge@xxxxxxxxxx> <8c28c76840fcc7b76c7c8ce4dc28a57241243df7.1292450600.git.jeremy.fitzhardinge@xxxxxxxxxx> <20110110212628.GC15016@xxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.13) Gecko/20101209 Fedora/3.1.7-0.35.b3pre.fc14 Lightning/1.0b3pre Thunderbird/3.1.7
On 01/11/2011 08:26 AM, Konrad Rzeszutek Wilk wrote:
> . snip..
>>  static int apply_to_pte_range(struct mm_struct *mm, pmd_t *pmd,
>>                                   unsigned long addr, unsigned long end,
>> -                                 pte_fn_t fn, void *data)
>> +                                 pte_batch_fn_t fn, void *data)
>>  {
>>      pte_t *pte;
>>      int err;
>> -    pgtable_t token;
>>      spinlock_t *uninitialized_var(ptl);
>>  
>>      pte = (mm == &init_mm) ?
>> @@ -1940,25 +1939,17 @@ static int apply_to_pte_range(struct mm_struct *mm, 
>> pmd_t *pmd,
>>      BUG_ON(pmd_huge(*pmd));
>>  
>>      arch_enter_lazy_mmu_mode();
>> -
>> -    token = pmd_pgtable(*pmd);
>> -
>> -    do {
>> -            err = fn(pte++, addr, data);
>> -            if (err)
>> -                    break;
>> -    } while (addr += PAGE_SIZE, addr != end);
>> -
>> +    err = fn(pte, (end - addr) / PAGE_SIZE, addr, data);
>>      arch_leave_lazy_mmu_mode();
>>  
>>      if (mm != &init_mm)
>> -            pte_unmap_unlock(pte-1, ptl);
>> +            pte_unmap_unlock(pte, ptl);
> That looks like a bug fix as well? Did this hit us before the change or was
> it masked by the fact that the code never go to here?

No, it isn't.  In the original code, "pte" would end up pointing into
the next page as the end state of the loop; the "-1" points it back to
the correct page.  With the new version, pte remains unchanged.

    J

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

<Prev in Thread] Current Thread [Next in Thread>