From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756288Ab2EHPQk (ORCPT ); Tue, 8 May 2012 11:16:40 -0400 Received: from terminus.zytor.com ([198.137.202.10]:57144 "EHLO mail.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755858Ab2EHPQj (ORCPT ); Tue, 8 May 2012 11:16:39 -0400 Message-ID: <4FA938AE.9070209@zytor.com> Date: Tue, 08 May 2012 08:15:58 -0700 From: "H. Peter Anvin" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:11.0) Gecko/20120329 Thunderbird/11.0.1 MIME-Version: 1.0 To: Alex Shi CC: mgorman@suse.de, npiggin@gmail.com, tglx@linutronix.de, mingo@redhat.com, arnd@arndb.de, rostedt@goodmis.org, fweisbec@gmail.com, jeremy@goop.org, gregkh@linuxfoundation.org, glommer@redhat.com, riel@redhat.com, luto@mit.edu, avi@redhat.com, len.brown@intel.com, dhowells@redhat.com, fenghua.yu@intel.com, borislav.petkov@amd.com, yinghai@kernel.org, ak@linux.intel.com, cpw@sgi.com, steiner@sgi.com, akpm@linux-foundation.org, penberg@kernel.org, hughd@google.com, rientjes@google.com, kosaki.motohiro@jp.fujitsu.com, n-horiguchi@ah.jp.nec.com, paul.gortmaker@windriver.com, trenn@suse.de, tj@kernel.org, oleg@redhat.com, axboe@kernel.dk, a.p.zijlstra@chello.nl, kamezawa.hiroyu@jp.fujitsu.com, viro@zeniv.linux.org.uk, linux-kernel@vger.kernel.org Subject: Re: [PATCH v3 4/7] x86/tlb: add tlb flush all factor for specific CPUs References: <1336485790-30902-1-git-send-email-alex.shi@intel.com> <1336485790-30902-5-git-send-email-alex.shi@intel.com> In-Reply-To: <1336485790-30902-5-git-send-email-alex.shi@intel.com> X-Enigmail-Version: 1.4 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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.