From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752354AbcHFVok (ORCPT ); Sat, 6 Aug 2016 17:44:40 -0400 Received: from mail-wm0-f68.google.com ([74.125.82.68]:35678 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752316AbcHFVoi (ORCPT ); Sat, 6 Aug 2016 17:44:38 -0400 Date: Sat, 6 Aug 2016 08:05:41 +0200 From: Ingo Molnar To: Davidlohr Bueso Cc: peterz@infradead.org, Waiman.Long@hp.com, jason.low2@hpe.com, wanpeng.li@hotmail.com, linux-kernel@vger.kernel.org, Davidlohr Bueso Subject: Re: [PATCH 3/3] locking/rwsem: Scan the wait_list for readers only once Message-ID: <20160806060541.GA20695@gmail.com> References: <1470384285-32163-1-git-send-email-dave@stgolabs.net> <1470384285-32163-4-git-send-email-dave@stgolabs.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1470384285-32163-4-git-send-email-dave@stgolabs.net> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org * Davidlohr Bueso wrote: > When wanting to wakeup readers, __rwsem_mark_wakeup() currently > iterates the wait_list twice while looking to wakeup the first N > queued reader-tasks. While this can be quite inefficient, it was > there such that a awoken reader would be first and foremost > acknowledged by the lock counter. > > Keeping the same logic, we can further benefit from the use of > wake_qs and avoid entirely the first wait_list iteration that sets > the counter as wake_up_process() isn't going to occur right away, > and therefore we maintain the counter->list order of going about > things. > > Other than saving cycles with O(n) "scanning", this change also > nicely cleans up a good chunk of __rwsem_mark_wakeup(); both > visually and less tedious to read. > > For example, the following improvements where seen on some will > it scale microbenchmarks, on a 48-core Haswell: > > v4.7 v4.7-rwsem-v1 > Hmean signal1-processes-8 5792691.42 ( 0.00%) 5771971.04 ( -0.36%) > Hmean signal1-processes-12 6081199.96 ( 0.00%) 6072174.38 ( -0.15%) > Hmean signal1-processes-21 3071137.71 ( 0.00%) 3041336.72 ( -0.97%) > Hmean signal1-processes-48 3712039.98 ( 0.00%) 3708113.59 ( -0.11%) > Hmean signal1-processes-79 4464573.45 ( 0.00%) 4682798.66 ( 4.89%) > Hmean signal1-processes-110 4486842.01 ( 0.00%) 4633781.71 ( 3.27%) > Hmean signal1-processes-141 4611816.83 ( 0.00%) 4692725.38 ( 1.75%) > Hmean signal1-processes-172 4638157.05 ( 0.00%) 4714387.86 ( 1.64%) > Hmean signal1-processes-203 4465077.80 ( 0.00%) 4690348.07 ( 5.05%) > Hmean signal1-processes-224 4410433.74 ( 0.00%) 4687534.43 ( 6.28%) Please always make it clear in changelogs what the numbers mean, that higher numbers are better, etc. - so that people don't have to re-read it 2-3 times to figure out what it means. Also, what are 'will it scale microbenchmarks'? Thanks, Ingo