Re: [PATCH v3 4/7] x86/tlb: add tlb flush all factor for specificCPUs

From: H. Peter Anvin
Date: Tue May 08 2012 - 11:16:36 EST


On 05/08/2012 07:03 AM, Alex Shi wrote:
>
> like some machine in my hands, balance points is 16 entries on Romely-EP;
> while it is at 8 entries on Bloomfield NHM-EP; but on model 15 core2 Xeon
> using invlpg has nothing help.
>
> For untested machine, no optimization now.
>

This seems a bit concerning from a forward compatibility point of view.
It would make more sense to assume that future processors would behave
more like the most recent (Sandy Bridge in your case) unless there is
evidence to the contrary.

>
> - if ((end - start)/PAGE_SIZE > act_entries/FLUSHALL_BAR)
> + if ((end - start)/PAGE_SIZE >
> + act_entries/tlb_flushall_factor)
> local_flush_tlb();

You are doing a dynamic division (and on unknown/older CPUs you're
dividing by zero!!) but all your divisors are powers of two. Make it a
shift instead.

-hpa

--
H. Peter Anvin, Intel Open Source Technology Center
I work for Intel. I don't speak on their behalf.

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