Re: [PATCH v4 4/7] x86/tlb: fall back to flush all when meet a THPlarge page

From: Alex Shi
Date: Sat May 12 2012 - 03:59:21 EST


On 05/12/2012 12:28 AM, Andrea Arcangeli wrote:

> Hi,
>
> On Thu, May 10, 2012 at 01:00:10PM +0800, Alex Shi wrote:
>> + for (addr = start; addr <= end; addr += HPAGE_SIZE) {
>> + pgd = pgd_offset(mm, addr);
>> + if (likely(!pgd_none(*pgd))) {
>> + pud = pud_offset(pgd, addr);
>> + if (likely(!pud_none(*pud))) {
>> + pmd = pmd_offset(pud, addr);
>> + if (likely(!pmd_none(*pmd)))
>> + if (pmd_large(*pmd))
>> + return 1;
>
> Note with THP we've to set the pmd temporarily not present during
> split_huge_page just before it returns a regular pmd (to avoid erratas
> and mixing 4k and 2m tlb on the same physical page). So pmd_large
> would fail in that small time window and we would do the invlpg loop
> (which should still work safe so no big deal). But I believe you could
> use pmd_trans_huge above, maybe gcc can drop the whole block with
> CONFIG_TRANSPARENT_HUGEPAGE=n.


Thanks the explanation.
Sure, if THP was not enabled, we can return 0 directly. :)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/