[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <4D2D0EBE.7040406@goop.org>
Date: Wed, 12 Jan 2011 13:15:26 +1100
From: Jeremy Fitzhardinge <jeremy@...p.org>
To: Konrad Rzeszutek Wilk <konrad.wilk@...cle.com>
CC: Andrew Morton <akpm@...ux-foundation.org>,
Haavard Skinnemoen <hskinnemoen@...el.com>,
Linux-MM <linux-mm@...ck.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Nick Piggin <npiggin@...nel.dk>,
Xen-devel <xen-devel@...ts.xensource.com>,
Jeremy Fitzhardinge <jeremy.fitzhardinge@...rix.com>
Subject: Re: [PATCH 2/9] mm: add apply_to_page_range_batch()
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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists