Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp312363pxf; Wed, 17 Mar 2021 06:05:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwewZDYIyuQEyyJOmxe0WVBDvvSI4y4gI3oK1a1oqiKGV0vpAr019N9/vzEfFvTEKvXhtZr X-Received: by 2002:a17:906:d9d1:: with SMTP id qk17mr35051280ejb.52.1615986304641; Wed, 17 Mar 2021 06:05:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615986304; cv=none; d=google.com; s=arc-20160816; b=XZRv6uO4zypI9j9ZTj4RmgaDyeC0SR0gHhV0dqmC+hPzqXDPCJW4h4hTV2/C3ouD0/ nsIDbj+UPW9m3g2mX9zu0o42PiZ8/ZPvH6GZ6t5qkKHxUz2LjkL7WgCoabPyzIREJCY6 FrIM22CdGrCLDp4oXXx2ODSBvl0bNOm3LorNKl39Ji4Nmxo25VVh9lXZwRHu3uNSdFlC EqMb4RDQ4d0xIbKM2dvQv9AitbPfZFWogbRLoY2jaWCc3XxcFor71cMzdQElaf0UqFLB R+LdegFK1XT6Do3B02N7r4yetilOdWSgdIcPbmyGOAoMz5N8gaJEvIOGR9OGYThSKh/G WkgQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=OsgWaEcn4B2Y823RuGirB7smdrHD9ktZSszdfbNXaUg=; b=M59zfrQcO5WtY+zgza0iZSiltNsCX2g9lRgAsklDJvfenQK2sgVhi6ajeBo9Rhai6L KbnFuvihmQJl4JO0I7QEDoxIJG8pzwAwC02L6ghTVQg3oTLvNiSLGHWxQHqbH53xNDqV /Y8GO3nPycdLA2m0dHrD59HGBHRaO8fBdl670VhCc4iR7JoAHfPbMEpSEPGy1UzZJcp0 2neEfWf6DDRYmwHdnlLAndgyNGx6zglpvKnhXYo7r2/KynRZa1QZIovpl6mZiAMkj+lp AZAPWCtZU58v7q8NGGkvMxhkbvkniFxq5WcsHfaSevSA/2ftU2kvOxNaQqk3K+Gy+ifE eSKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=XA+1uUVn; 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 v4si16466520ejx.329.2021.03.17.06.04.33; Wed, 17 Mar 2021 06:05:04 -0700 (PDT) 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; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=XA+1uUVn; 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 S230270AbhCQNAX (ORCPT + 99 others); Wed, 17 Mar 2021 09:00:23 -0400 Received: from casper.infradead.org ([90.155.50.34]:34866 "EHLO casper.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229964AbhCQNAB (ORCPT ); Wed, 17 Mar 2021 09:00:01 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=OsgWaEcn4B2Y823RuGirB7smdrHD9ktZSszdfbNXaUg=; b=XA+1uUVnlgXcQjbmDjnaBuuEGR flhEq42UNEW4sYM0rYOZ7WUmbAL6XtRJyKNJ4Ucn/xgXOkZbK/Ik8+TnijKolPD6cX3QmHCiEViIC /s0XB2mCOKTk4twi9ZRWJ4wIDSPWkLjabmSpZsRrt/QP6Kwhspea/Z/Getkon820mAhQ4iBRmHnoA TgPzTzT39v/5TbC/63CYBmxDppHGJOOBvFwa2QRxdW4CkQRRUu0AZaatHVtc/HpXx8oN66setnybA cGoE5ZNf8vXBtevL9FDPulEq48QiBhvdOkmqpW9s5WDZT3DYgqSRNZUTAgKZcVoLf25YhkWjsUCn/ txYZFmuw==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.94 #2 (Red Hat Linux)) id 1lMVm5-001UL8-1g; Wed, 17 Mar 2021 12:59:49 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 10F833050F0; Wed, 17 Mar 2021 13:59:44 +0100 (CET) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id EF79A2B4F1EB8; Wed, 17 Mar 2021 13:59:43 +0100 (CET) Date: Wed, 17 Mar 2021 13:59:43 +0100 From: Peter Zijlstra To: linux-kernel@vger.kernel.org Cc: linux-tip-commits@vger.kernel.org, Waiman Long , Ingo Molnar , Davidlohr Bueso , x86@kernel.org Subject: Re: [tip: locking/urgent] locking/ww_mutex: Simplify use_ww_ctx & ww_ctx handling Message-ID: References: <20210316153119.13802-2-longman@redhat.com> <161598470257.398.5006518584847290113.tip-bot2@tip-bot2> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <161598470257.398.5006518584847290113.tip-bot2@tip-bot2> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Mar 17, 2021 at 12:38:22PM -0000, tip-bot2 for Waiman Long wrote: > The following commit has been merged into the locking/urgent branch of tip: > > Commit-ID: 5de2055d31ea88fd9ae9709ac95c372a505a60fa > Gitweb: https://git.kernel.org/tip/5de2055d31ea88fd9ae9709ac95c372a505a60fa > Author: Waiman Long > AuthorDate: Tue, 16 Mar 2021 11:31:16 -04:00 > Committer: Ingo Molnar > CommitterDate: Wed, 17 Mar 2021 09:56:44 +01:00 > > locking/ww_mutex: Simplify use_ww_ctx & ww_ctx handling > > The use_ww_ctx flag is passed to mutex_optimistic_spin(), but the > function doesn't use it. The frequent use of the (use_ww_ctx && ww_ctx) > combination is repetitive. > > In fact, ww_ctx should not be used at all if !use_ww_ctx. Simplify > ww_mutex code by dropping use_ww_ctx from mutex_optimistic_spin() an > clear ww_ctx if !use_ww_ctx. In this way, we can replace (use_ww_ctx && > ww_ctx) by just (ww_ctx). The reason this code was like this is because GCC could constant propagage use_ww_ctx but could not do the same for ww_ctx (since that's external). Please double check generated code to make sure you've not introduced a bunch of extra branches.