From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58298) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bz3yu-00020M-HF for qemu-devel@nongnu.org; Tue, 25 Oct 2016 11:49:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bz3yt-000339-NY for qemu-devel@nongnu.org; Tue, 25 Oct 2016 11:49:40 -0400 Received: from mail-oi0-x244.google.com ([2607:f8b0:4003:c06::244]:33883) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1bz3yt-000332-Ih for qemu-devel@nongnu.org; Tue, 25 Oct 2016 11:49:39 -0400 Received: by mail-oi0-x244.google.com with SMTP id p136so7788110oic.1 for ; Tue, 25 Oct 2016 08:49:39 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <5b91345d-fea6-8d98-69a9-eda1e256c3e1@redhat.com> References: <20161025153507.27110-1-bobby.prani@gmail.com> <5b91345d-fea6-8d98-69a9-eda1e256c3e1@redhat.com> From: Pranith Kumar Date: Tue, 25 Oct 2016 11:49:08 -0400 Message-ID: Content-Type: text/plain; charset=UTF-8 Subject: Re: [Qemu-devel] [RFC PATCH] qht: Align sequence lock to cache line List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: Richard Henderson , =?UTF-8?B?QWxleCBCZW5uw6ll?= , Markus Armbruster , "Emilio G. Cota" , "open list:All patches CC here" On Tue, Oct 25, 2016 at 11:41 AM, Paolo Bonzini wrote: > > > On 25/10/2016 17:35, Pranith Kumar wrote: >> Using perf, I see that sequence lock is being a bottleneck since it is >> being read by everyone. Giving it its own cache-line seems to help >> things quite a bit. >> >> Using qht-bench, I measured the following for: >> >> $ ./tests/qht-bench -d 10 -n 24 -u >> >> throughput base patch %change >> update >> 0 8.07 13.33 +65% >> 10 7.10 8.90 +25% >> 20 6.34 7.02 +10% >> 30 5.48 6.11 +9.6% >> 40 4.90 5.46 +11.42% >> >> I am not able to see any significant increases for lower thread counts though. > > Whoa, that's a bit of a heavy hammer. The idea is that whoever modifies > the seqlock must take the spinlock first, and whoever reads the seqlock > will read one of the members of hashes[]/pointers[]. So having > everything in the same cacheline should be better. But we are taking the seqlock of only the head bucket, while the readers are reading hashes/pointers of the chained buckets. > > What happens if you just change QHT_BUCKET_ALIGN to 128? > 0 4.47 10 9.82 (weird!) 20 8.13 30 7.13 40 6.45 Thanks, -- Pranith