public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
To: "Chris Wilson" <chris@chris-wilson.co.uk>,
	"Peter Zijlstra" <peterz@infradead.org>,
	"Ingo Molnar" <mingo@redhat.com>,
	intel-gfx@lists.freedesktop.org,
	"Christian König" <christian.koenig@amd.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mutex: Do not spin/queue before performing ww_mutex deadlock avoidance
Date: Thu, 26 May 2016 13:08:58 +0200	[thread overview]
Message-ID: <5c99773f-448d-6ca7-e28e-c262a82ee58a@linux.intel.com> (raw)
In-Reply-To: <20160526104329.GS15901@nuc-i3427.alporthouse.com>

Op 26-05-16 om 12:43 schreef Chris Wilson:
> On Thu, May 26, 2016 at 12:37:30PM +0200, Maarten Lankhorst wrote:
>> The check should also not be for NULL, but for use_ww_ctx.
>> This way the if check is optimized out for the ww_ctx path, where
>> ww_ctx is always non-null.
> The compiler can see use_ww_ctx == false => ww_ctx == NULL just as well
> to do dead-code elimination, i.e. use_ww_ctx is superflouus and does not
> reduce the code size. (gcc 4.7.2, 4.9.1, 5.3.1)
That's true, but it cannot do the same when use_ww_ctx = true.
In this case the function will always be called with ww_ctx != NULL,
but the compiler can't see that, so it will keep the check even if it's always true.

~Maarten

  reply	other threads:[~2016-05-26 11:09 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-26  8:31 [PATCH] mutex: Do not spin/queue before performing ww_mutex deadlock avoidance Chris Wilson
2016-05-26 10:37 ` Maarten Lankhorst
2016-05-26 10:43   ` Chris Wilson
2016-05-26 11:08     ` Maarten Lankhorst [this message]
2016-05-26 20:08 ` [PATCH] mutex: Report recursive ww_mutex locking early Chris Wilson
2016-05-30  7:43   ` Maarten Lankhorst
2016-05-30  9:11     ` Peter Zijlstra
2016-05-30  9:43       ` Maarten Lankhorst
2016-05-30 10:27         ` Peter Zijlstra
2016-05-30 10:45           ` Chris Wilson
2016-05-30 11:16             ` Maarten Lankhorst
2016-06-03 10:46   ` [tip:locking/core] locking/ww_mutex: " tip-bot for Chris Wilson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5c99773f-448d-6ca7-e28e-c262a82ee58a@linux.intel.com \
    --to=maarten.lankhorst@linux.intel.com \
    --cc=chris@chris-wilson.co.uk \
    --cc=christian.koenig@amd.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox