Re: [PATCH v4 5/7] x86/tlb: add tlb flush all factor for specificCPU

From: Peter Zijlstra
Date: Fri May 11 2012 - 05:05:12 EST


On Fri, 2012-05-11 at 08:49 +0800, Alex Shi wrote:
> On 05/10/2012 05:38 PM, Peter Zijlstra wrote:
>
> > On Thu, 2012-05-10 at 13:00 +0800, Alex Shi wrote:
> >
> >
> >> +void intel_tlb_flushall_factor_set(struct cpuinfo_x86 *c)
> >> +{
> >> + if (!cpu_has_invlpg) {
> >> + tlb_flushall_factor = -1;
> >> + return;
> >> + }
> >
> > ...
> >
> >> + if (!cpu_has_invlpg || vma->vm_flags & VM_HUGETLB
> >> + || tlb_flushall_factor == (u16)TLB_FLUSH_ALL)
> >> {
> >> flush_all:
> >
> > Since you set tlb_flushall_factor (I'd have called it _shift) to -1
> > when !invlpg there's a redundant check in there.
> >
>
>
>
> NO, the first judgement is from CPU. But second '-1' is may from user
> setting in sysfs.

Then you're doing it wrong. Don't allow setting the sysfs variable if !
cpu_has_invlpg.
--
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/