From: Peter Zijlstra <peterz@infradead.org>
To: Andreas Mohr <andi@lisas.de>
Cc: Waiman Long <Waiman.Long@hpe.com>,
Daniel Vetter <daniel.vetter@intel.com>,
linux-kernel@vger.kernel.org
Subject: Re: [RFC][PATCH -v2 1/4] locking/drm/i915: Kill mutex trickery
Date: Fri, 26 Aug 2016 11:10:32 +0200 [thread overview]
Message-ID: <20160826091032.GO10138@twins.programming.kicks-ass.net> (raw)
In-Reply-To: <20160826032509.GA29502@rhlx01.hs-esslingen.de>
On Fri, Aug 26, 2016 at 05:25:09AM +0200, Andreas Mohr wrote:
> > Another alternative is to provide a standard mutex API that returns the
> > owner of the lock if there is a real need for this capability. Peeking
> > into lock internal is not a good practice.
> So, it seems the most we could provide which would offer a reliable,
> non-racy API protocol is something like:
>
> static bool mutex_is_locked_by_us(struct mutex *mutex)
>
> since during execution of this processing it would be guaranteed that:
> - either we do have the lock, thus *we* *RELIABLY* are and will be "the owner"
> - or we simply do not have it, thus *we* *RELIABLY* are and will be "not the owner"
Right, and that is exactly what they attempted and need. And the new
mutex implementation could actually do this much better than the old
one.
But yes, such an interface should be part of the mutex implementation
proper, not something hacked on in random places.
Fwiw, the build bot seems to have found another instance of this thing
:/ drivers/gpu/drm/msm/msm_gem_shrinker.c includes an exact copy.
next prev parent reply other threads:[~2016-08-26 9:11 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-26 3:25 Andreas Mohr
2016-08-26 9:10 ` Peter Zijlstra [this message]
2016-08-26 14:33 ` Waiman Long
-- strict thread matches above, loose matches on Subject: below --
2016-08-25 18:37 [RFC][PATCH -v2 0/4] locking/mutex: Rewrite basic mutex Peter Zijlstra
2016-08-25 18:37 ` [RFC][PATCH -v2 1/4] locking/drm/i915: Kill mutex trickery Peter Zijlstra
2016-08-25 19:36 ` Daniel Vetter
2016-08-25 19:59 ` Waiman Long
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=20160826091032.GO10138@twins.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=Waiman.Long@hpe.com \
--cc=andi@lisas.de \
--cc=daniel.vetter@intel.com \
--cc=linux-kernel@vger.kernel.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
Powered by JetHome