[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CANpmjNPrREVGC3Az0T7k_2yr1PJp+E4yURUGUnu9Jb_CShJNHw@mail.gmail.com>
Date: Thu, 6 Apr 2023 13:21:28 +0200
From: Marco Elver <elver@...gle.com>
To: David Laight <David.Laight@...lab.com>
Cc: Peter Zijlstra <peterz@...radead.org>,
Wedson Almeida Filho <wedsonaf@...il.com>,
Greg KH <gregkh@...uxfoundation.org>,
"rust-for-linux@...r.kernel.org" <rust-for-linux@...r.kernel.org>,
Miguel Ojeda <ojeda@...nel.org>,
Alex Gaynor <alex.gaynor@...il.com>,
Boqun Feng <boqun.feng@...il.com>, Gary Guo <gary@...yguo.net>,
Björn Roy Baron <bjorn3_gh@...tonmail.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
Wedson Almeida Filho <walmeida@...rosoft.com>,
Ingo Molnar <mingo@...hat.com>, Will Deacon <will@...nel.org>,
Waiman Long <longman@...hat.com>
Subject: Re: [PATCH v2 03/13] rust: lock: introduce `Mutex`
On Thu, 6 Apr 2023 at 10:38, David Laight <David.Laight@...lab.com> wrote:
>
> From: Peter Zijlstra
> > Sent: 05 April 2023 21:50
> >
> > On Wed, Apr 05, 2023 at 05:40:39PM -0300, Wedson Almeida Filho wrote:
> ...
> > > So the situation is improved in that we don't need to manually write (and
> > > commit) the helpers. It may improve further in the future if we get better
> > > integration of the languages.
> >
> > But yeah, feel free to convert macros to inline functions where the
> > difference is moot. There is indeed no real reason for mutex_lock() to
> > not be an inline function in that case.
>
> mutex_lock() is probably ok.
> But there are cases where gcc generates much better code
> for #defines than for inline functions.
> Almost certainly because the front end gets to optimise
> #defines, but inlines are done much later on.
For macro to inline function conversions, the most conservative option
would be __always_inline. We've also seen things go wrong with
"inline" only paired with various kinds of instrumentation.
Can bindgen deal with "static __always_inline" functions?
Powered by blists - more mailing lists