From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51312) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aobSP-0000Mj-8g for qemu-devel@nongnu.org; Fri, 08 Apr 2016 14:48:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aobSM-0003uH-2t for qemu-devel@nongnu.org; Fri, 08 Apr 2016 14:48:37 -0400 Received: from mail-qk0-x242.google.com ([2607:f8b0:400d:c09::242]:36282) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aobSL-0003uA-V0 for qemu-devel@nongnu.org; Fri, 08 Apr 2016 14:48:34 -0400 Received: by mail-qk0-x242.google.com with SMTP id e124so5418133qkc.3 for ; Fri, 08 Apr 2016 11:48:33 -0700 (PDT) Sender: Richard Henderson References: <1460050358-25025-1-git-send-email-cota@braap.org> <1460050358-25025-11-git-send-email-cota@braap.org> From: Richard Henderson Message-ID: <5707FCFE.4070607@twiddle.net> Date: Fri, 8 Apr 2016 11:48:30 -0700 MIME-Version: 1.0 In-Reply-To: <1460050358-25025-11-git-send-email-cota@braap.org> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v2 10/13] tb hash: hash phys_pc, pc, and flags with xxhash List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Emilio G. Cota" , QEMU Developers , MTTCG Devel Cc: =?UTF-8?Q?Alex_Benn=c3=a9e?= , Paolo Bonzini , Peter Crosthwaite , Peter Maydell , Sergey Fedorov On 04/07/2016 10:32 AM, Emilio G. Cota wrote: > For some workloads such as arm bootup, tb_phys_hash is performance-critical. > The is due to the high frequency of accesses to the hash table, originated > by (frequent) TLB flushes that wipe out the cpu-private tb_jmp_cache's. > More info: > https://lists.nongnu.org/archive/html/qemu-devel/2016-03/msg05098.html > > To dig further into this I modified an arm image booting debian jessie to > immediately shut down after boot. Analysis revealed that quite a bit of time > is unnecessarily spent in tb_phys_hash: the cause is poor hashing that > results in very uneven loading of chains in the hash table's buckets; > the longest observed chain had ~550 elements. > > The appended addresses this with two changes: > > 1) Use xxhash as the hash table's hash function. xxhash is a fast, > high-quality hashing function. > > 2) Feed the hashing function with not just tb_phys, but also pc and flags. Reviewed-by: Richard Henderson r~