Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp1608657pxb; Fri, 20 Nov 2020 14:04:35 -0800 (PST) X-Google-Smtp-Source: ABdhPJwGze0cS0jQslEcn1fPaE8Hmpz6ZBvT5tsfAF+r4Pq75iHaLRLu29XfEv9Ea41i6jxM/DGh X-Received: by 2002:a50:a1c6:: with SMTP id 64mr12206852edk.156.1605909875320; Fri, 20 Nov 2020 14:04:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605909875; cv=none; d=google.com; s=arc-20160816; b=VIgmvg0s64Brv3eBTczrfx59Ogy9LsrXL9eY7SZGL9Y3DCZWkUA6flm4Fzu+9BfIh8 lwfi2yEZyxcUG+qHCwAL1rKAMKhEbUSCUPKc17lKTuLwyhk6EubI6P5pUWYEmmGZzk6P exAW4H5ATL//Xor+hZe1IGTAeMTOXQa2PzJ+QJ4YTgHrVszdXPBwjSpUzg4kTRtTcqpX fac9m9lekrBSMi2/TK/+9MCLs+IJBIe0TEu9bSZ4kYDpdgKTiW9AdqKdfRa9bwe6u83J AQ1Myjvc0gB9jL1UAL6xTEQSWz0flGn23thiw6pal5LFGsOun5f4cqT1vH9WrYEUJMpt E/gg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=93v2lV09ayNj67pop6kSEsnrDS7pbVldgpfkFDUS5W8=; b=w0Kyk3wtayTU6whJwOTmAkEOmAMLxWW5qimT2hh47EOdvt3ZGmFNyICS9GfzFwWjL5 ZMZu2WNJLaaTwTy3DCSUy3OSShWGirWGCvMlzVg7qQHb/oYZUfEHu+snWskiqaLQu9am E6uuLctDoo8r/+cCJ1XV3uw9pFpZWuf1HBabBSPUBHYKI6uTIXXCY6peAditoLAUQvWj O72pj5tYb9GRH9omUf+FZXXIiCEyyccLJHR4SANLDHIjhvKWSRi0vLpe3+KsTZsmTyV2 bfLOQrGzjCHZAvehNYBI2iVEVC/Wu27jzirqyPS54lH816Fm/TunvnvDVbD2zCDHyYBi 5XGQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v10si2455630ejy.467.2020.11.20.14.04.10; Fri, 20 Nov 2020 14:04:35 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728039AbgKTWBl (ORCPT + 99 others); Fri, 20 Nov 2020 17:01:41 -0500 Received: from mx2.suse.de ([195.135.220.15]:43510 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727417AbgKTWBk (ORCPT ); Fri, 20 Nov 2020 17:01:40 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 8CD39AC23; Fri, 20 Nov 2020 22:01:39 +0000 (UTC) Date: Fri, 20 Nov 2020 13:38:28 -0800 From: Davidlohr Bueso To: David Laight Cc: 'Waiman Long' , Peter Zijlstra , Ingo Molnar , Will Deacon , "linux-kernel@vger.kernel.org" , Phil Auld Subject: Re: [RFC PATCH 5/5] locking/rwsem: Remove reader optimistic spinning Message-ID: <20201120213828.n7f23qy75hduommo@linux-p48b.lan> References: <20201118030429.23017-1-longman@redhat.com> <20201118030429.23017-6-longman@redhat.com> <20201118053556.3fmmtat7upv6dtvd@linux-p48b.lan> <5fe76531782f4a8492b341d5f381147b@AcuMS.aculab.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <5fe76531782f4a8492b341d5f381147b@AcuMS.aculab.com> User-Agent: NeoMutt/20180716 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 20 Nov 2020, David Laight wrote: >I got massive performance improvements from changing a driver >we have to use mutex instead of the old semaphores (the driver >was written a long time ago). > >While these weren't 'rw' the same issue will apply. > >The problem was that the semaphore/mutex was typically only held over >a few instructions (eg to add an item to a list). >But with semaphore if you got contention the process always slept. >OTOH mutex spin 'for a while' before sleeping so the code rarely slept. The caveat here is if you are using trylock/unlock from irq, which is the only reason why regular semaphores are still around today. If not, indeed a mutex is better. Thanks, Davidlohr