From mboxrd@z Thu Jan 1 00:00:00 1970 From: Waiman Long Subject: Re: [RFC PATCH-tip v4 07/10] locking/rwsem: Change RWSEM_WAITING_BIAS for better disambiguation Date: Fri, 19 Aug 2016 12:21:57 -0400 Message-ID: <57B73225.7020303@hpe.com> References: <1471554672-38662-1-git-send-email-Waiman.Long@hpe.com> <1471554672-38662-8-git-send-email-Waiman.Long@hpe.com> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org To: Wanpeng Li Cc: Peter Zijlstra , Ingo Molnar , "linux-kernel@vger.kernel.org" , the arch/x86 maintainers , linux-alpha@vger.kernel.org, linux-ia64@vger.kernel.org, linux-s390 , linux-arch@vger.kernel.org, linux-doc@vger.kernel.org, Davidlohr Bueso , Jason Low , Dave Chinner , Jonathan Corbet , Scott J Norton , Douglas Hatch List-Id: linux-arch.vger.kernel.org On 08/19/2016 01:57 AM, Wanpeng Li wrote: > 2016-08-19 5:11 GMT+08:00 Waiman Long: >> When the count value is in between 0 and RWSEM_WAITING_BIAS, there >> are 2 possibilities. >> Either a writer is present and there is no waiter > count = 0xffff0001 > >> or there are waiters and readers. There is no easy way to > count = 0xffff000X > > However, RWSEM_WAITING_BIAS is equal to 0xffff0000, so both these two > cases are beyond RWSEM_WAITING_BIAS, right? > > Regards, > Wanpeng Li Perhaps I should make it clear that I am talking from a signed quantity point of view (it is an atomic_long_t). So RWSEM_WAITING_BIAS < RWSEM_ACTIVE_WRITE_BIAS < 0 Hope this clarify your question. Cheers, Longman From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-dm3nam03on0100.outbound.protection.outlook.com ([104.47.41.100]:21120 "EHLO NAM03-DM3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754510AbcHSR4h (ORCPT ); Fri, 19 Aug 2016 13:56:37 -0400 Message-ID: <57B73225.7020303@hpe.com> Date: Fri, 19 Aug 2016 12:21:57 -0400 From: Waiman Long MIME-Version: 1.0 Subject: Re: [RFC PATCH-tip v4 07/10] locking/rwsem: Change RWSEM_WAITING_BIAS for better disambiguation References: <1471554672-38662-1-git-send-email-Waiman.Long@hpe.com> <1471554672-38662-8-git-send-email-Waiman.Long@hpe.com> In-Reply-To: Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-arch-owner@vger.kernel.org List-ID: To: Wanpeng Li Cc: Peter Zijlstra , Ingo Molnar , "linux-kernel@vger.kernel.org" , the arch/x86 maintainers , linux-alpha@vger.kernel.org, linux-ia64@vger.kernel.org, linux-s390 , linux-arch@vger.kernel.org, linux-doc@vger.kernel.org, Davidlohr Bueso , Jason Low , Dave Chinner , Jonathan Corbet , Scott J Norton , Douglas Hatch Message-ID: <20160819162157.l-1bxvhVU9UHrMLvkDKS0cZAw-2FePPoWVhI45nqFzI@z> On 08/19/2016 01:57 AM, Wanpeng Li wrote: > 2016-08-19 5:11 GMT+08:00 Waiman Long: >> When the count value is in between 0 and RWSEM_WAITING_BIAS, there >> are 2 possibilities. >> Either a writer is present and there is no waiter > count = 0xffff0001 > >> or there are waiters and readers. There is no easy way to > count = 0xffff000X > > However, RWSEM_WAITING_BIAS is equal to 0xffff0000, so both these two > cases are beyond RWSEM_WAITING_BIAS, right? > > Regards, > Wanpeng Li Perhaps I should make it clear that I am talking from a signed quantity point of view (it is an atomic_long_t). So RWSEM_WAITING_BIAS < RWSEM_ACTIVE_WRITE_BIAS < 0 Hope this clarify your question. Cheers, Longman