From: Alice Ryhl <aliceryhl@google.com>
To: Peder Bergan <peder.bergan@gmail.com>
Cc: "Alice Ryhl" <aliceryhl@google.com>,
"Carlos Llamas" <cmllamas@google.com>,
"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
"Arve Hjønnevåg" <arve@android.com>,
"Todd Kjos" <tkjos@android.com>,
"Christian Brauner" <brauner@kernel.org>,
rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] rust_binder: Reuse the thread lock in get_work_local()
Date: Tue, 24 Nov 2026 18:53:54 +0000 [thread overview]
Message-ID: <20261124185354.3821154-1-aliceryhl@google.com> (raw)
In-Reply-To: <20261124-perf-binder-local-work-lock-v1-1-bd8de1a840c1@gmail.com>
On Tue, Nov 24, 2026 at 04:04:27PM +0100, Peder Bergan wrote:
> get_work_local() takes the thread lock to check looper_need_return.
> When the flag is clear, it drops and retakes the lock before trying to
> pop work for either a blocking or a nonblocking read.
>
> Keep the guard across the flag check and the first pop. A blocking
> read that finds no work still registers its wait before the condition
> variable releases the guard, so a producer can wake the reader.
>
> Signed-off-by: Peder Bergan <peder.bergan@gmail.com>
Looks good to me! Unlike get_work(), get_work_local() never needs to
acquire the process lock, so dropping self.inner between checking
looper_need_return and calling pop_work() was unnecessary.
Reviewed-by: Alice Ryhl <aliceryhl@google.com>
Alice
prev parent reply other threads:[~2026-11-24 18:53 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-24 15:04 Peder Bergan via B4 Relay
2026-11-24 18:53 ` Alice Ryhl [this message]
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=20261124185354.3821154-1-aliceryhl@google.com \
--to=aliceryhl@google.com \
--cc=arve@android.com \
--cc=brauner@kernel.org \
--cc=cmllamas@google.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=peder.bergan@gmail.com \
--cc=rust-for-linux@vger.kernel.org \
--cc=tkjos@android.com \
/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
all inboxes | Powered by JetHome®