From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932133AbbA2UNZ (ORCPT ); Thu, 29 Jan 2015 15:13:25 -0500 Received: from g9t1613g.houston.hp.com ([15.240.0.71]:56282 "EHLO g9t1613g.houston.hp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753320AbbA2UNY (ORCPT ); Thu, 29 Jan 2015 15:13:24 -0500 Message-ID: <1422562401.2418.13.camel@j-VirtualBox> Subject: Re: [PATCH 4/6] locking/rwsem: Avoid deceiving lock spinners From: Jason Low To: Davidlohr Bueso Cc: Peter Zijlstra , Ingo Molnar , "Paul E. McKenney" , Michel Lespinasse , Tim Chen , linux-kernel@vger.kernel.org, jason.low2@hp.com Date: Thu, 29 Jan 2015 12:13:21 -0800 In-Reply-To: <1422493812.4604.29.camel@stgolabs.net> References: <1422257769-14083-1-git-send-email-dave@stgolabs.net> <1422257769-14083-5-git-send-email-dave@stgolabs.net> <1422379430.6710.6.camel@j-VirtualBox> <1422417294.4604.15.camel@stgolabs.net> <1422479028.4111.34.camel@j-VirtualBox> <1422493812.4604.29.camel@stgolabs.net> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.2.3-0ubuntu6 Content-Transfer-Encoding: 7bit Mime-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 2015-01-28 at 17:10 -0800, Davidlohr Bueso wrote: > if (READ_ONCE(sem->owner)) > return true; /* new owner, continue spinning */ In terms of the sem->owner check, I agree. This also reminds me of a similar patch I was going to send out, but for mutex. The idea is that before we added all the MCS logic, we wanted to return false if owner isn't NULL to prevent too many threads simultaneously spinning on the owner at the same time. With the new MCS queuing, we don't have to worry about that issue, so it makes sense to continue spinning as long as owner is running and the spinner doesn't need to reschedule.