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

From: Andrea Arcangeli
Date: Fri May 11 2012 - 14:11:31 EST


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.
--
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/