Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756158AbbDXO4V (ORCPT ); Fri, 24 Apr 2015 10:56:21 -0400 Received: from g4t3426.houston.hp.com ([15.201.208.54]:37464 "EHLO g4t3426.houston.hp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932475AbbDXO4T (ORCPT ); Fri, 24 Apr 2015 10:56:19 -0400 Message-ID: <553A598E.8080900@hp.com> Date: Fri, 24 Apr 2015 10:56:14 -0400 From: Waiman Long User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.12) Gecko/20130109 Thunderbird/10.0.12 MIME-Version: 1.0 To: Davidlohr Bueso CC: Peter Zijlstra , Ingo Molnar , linux-kernel@vger.kernel.org, Jason Low , Scott J Norton , Douglas Hatch Subject: Re: [PATCH v2] locking/rwsem: reduce spinlock contention in wakeup after up_read/up_write References: <1429813449-19641-1-git-send-email-Waiman.Long@hp.com> <1429824690.10273.41.camel@stgolabs.net> In-Reply-To: <1429824690.10273.41.camel@stgolabs.net> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1296 Lines: 29 On 04/23/2015 05:31 PM, Davidlohr Bueso wrote: > It would be nice to not run into this by accident. Please CC all > relevant parties ;) > > On Thu, 2015-04-23 at 14:24 -0400, Waiman Long wrote: >> In up_read()/up_write(), rwsem_wake() will be called whenever it >> detects that some writers/readers are waiting. The rwsem_wake() >> function will take the wait_lock and call __rwsem_do_wake() to do >> the real wakeup. This can be a problem especially for up_read() >> where many readers can potentially call rwsem_wake() at more or less >> the same time even though a single call should be enough. This will >> cause contention in the wait_lock cacheline resulting in delay of >> the up_read/up_write operations. > Ok. > >> This patch makes the wait_lock taking and the call to __rwsem_do_wake() >> optional if at least one spinning writer is present. > But if the lock is taken by readers, like you suggest above, there > cannot be any active spinners. We always block in these cases. Yes, you are right. Will fix the log message. Cheers, Longman -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/