From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752756AbdASNdl (ORCPT ); Thu, 19 Jan 2017 08:33:41 -0500 Received: from smtprelay0186.hostedemail.com ([216.40.44.186]:49747 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752643AbdASNdj (ORCPT ); Thu, 19 Jan 2017 08:33:39 -0500 X-Session-Marker: 726F737465647440676F6F646D69732E6F7267 X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,rostedt@goodmis.org,:::::,RULES_HIT:41:355:379:541:599:800:960:968:973:988:989:1260:1277:1311:1313:1314:1345:1359:1437:1515:1516:1518:1534:1541:1593:1594:1711:1730:1747:1777:1792:2194:2198:2199:2200:2393:2553:2559:2562:2693:3138:3139:3140:3141:3142:3353:3622:3865:3866:3867:3868:3870:3871:3872:3873:3874:5007:6119:6261:7875:7903:10004:10394:10400:10848:10967:11026:11232:11658:11914:12296:12740:12760:12895:13069:13161:13229:13311:13357:13439:14096:14097:14181:14659:14721:21063:21080:30054:30055:30083:30090:30091,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:2,LUA_SUMMARY:none X-HE-Tag: blade67_7099fd57dd34d X-Filterd-Recvd-Size: 2275 Date: Thu, 19 Jan 2017 08:32:52 -0500 From: Steven Rostedt To: Chris Wilson Cc: LKML , Peter Zijlstra Subject: Re: __mutex_lock_common() unlikely very likely Message-ID: <20170119083252.6cbb0c8d@gandalf.local.home> In-Reply-To: <20170119085507.GA28607@nuc-i3427.alporthouse.com> References: <20170118155824.689a9996@gandalf.local.home> <20170119085507.GA28607@nuc-i3427.alporthouse.com> X-Mailer: Claws Mail 3.14.0 (GTK+ 2.24.31; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 19 Jan 2017 08:55:07 +0000 Chris Wilson wrote: > On Wed, Jan 18, 2017 at 03:58:24PM -0500, Steven Rostedt wrote: > > Chris, > > > > My branch tracer flagged the unlikely in __mutex_lock_common() as > > always hit. That's the: > > > > if (use_ww_ctx) { > > [...] > > if (unlikely(ww_ctx == READ_ONCE(ww->ctx))) > > return -EALREADY; > > } > > > > This is hit 100% of the time, and its coming from the drm logic: > > By design this is an exceptional case. In practice, drm modesetting is a > little slapsidasical when it comes to locking. However, it is the > minority use case, just that on intel, the more prevalent users do not > hit this path - though they will with the ww_mutex refactoring work. ttm > drivers (amdgpu, nouveau etc) will be demonstrating that this is the > unlikely branch. > Then I suggest that we remove the unlikely, as it's only "unlikely" if you have the right hardware. If you don't (and I appear to have three boxes that don't) then it becomes very likely. "unlikely" is not about how likely you have the right hardware. It's about high likely the logic is. If it's a hardware issue, it shouldn't have a likely or unlikely attached to it. I'll send a patch to nuke it. When drm is no longer a special case, because it's a popular platform, we can add it back. -- Steve