From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751334AbdBZTDn (ORCPT ); Sun, 26 Feb 2017 14:03:43 -0500 Received: from mx2.suse.de ([195.135.220.15]:34349 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751219AbdBZTDm (ORCPT ); Sun, 26 Feb 2017 14:03:42 -0500 Date: Sun, 26 Feb 2017 10:49:24 -0800 From: Davidlohr Bueso To: Waiman Long Cc: Ingo Molnar , Peter Zijlstra , linux-kernel@vger.kernel.org Subject: Re: [PATCH-tip 1/3] locking/rwsem: Check wait_list without lock if spinner present Message-ID: <20170226184924.GE5126@linux-80c1.suse> References: <1487786634-22641-1-git-send-email-longman@redhat.com> <1487786634-22641-2-git-send-email-longman@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <1487786634-22641-2-git-send-email-longman@redhat.com> 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 On Wed, 22 Feb 2017, Waiman Long wrote: >We can safely check the wait_list to see if waiters are present without >lock when there are spinners to fall back on in case we miss a waiter. >The advantage is that we can save a pair of spin_lock/unlock calls >when the wait_list is empty. This translates to a reduction in latency >and hence slightly better performance. This benefit is only seen in (rare) situations where there are only writers with short hold times, no? I don't really have any objection as I doubt the additional load will have any impact on the common case, but it would still be nice to have more data for other benchmarks where the lock is at least shared at times -- ie: a good thing to measure is also fault, mmap related benchmarks. >+ /* >+ * Normally checking wait_list without wait_lock isn't safe >+ * as we may miss an incoming waiter. With spinners present, >+ * however, we have someone to fall back on in case that >+ * happens. This can save a pair of spin_lock/unlock calls >+ * when there is no waiter. >+ */ I would drop the last part regarding saving the spin_lock, it should be evident from the code. Thanks, Davidlohr