From: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>
To: Alice Ryhl <aliceryhl@google.com>
Cc: "Miguel Ojeda" <ojeda@kernel.org>,
"Andrew Morton" <akpm@linux-foundation.org>,
"Alex Gaynor" <alex.gaynor@gmail.com>,
"Wedson Almeida Filho" <wedsonaf@gmail.com>,
"Boqun Feng" <boqun.feng@gmail.com>,
"Gary Guo" <gary@garyguo.net>,
"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
"Benno Lossin" <benno.lossin@proton.me>,
"Andreas Hindborg" <a.hindborg@samsung.com>,
"Marco Elver" <elver@google.com>, "Coly Li" <colyli@suse.de>,
"Paolo Abeni" <pabeni@redhat.com>,
"Pierre Gondois" <pierre.gondois@arm.com>,
"Ingo Molnar" <mingo@kernel.org>,
"Jakub Kicinski" <kuba@kernel.org>,
"Wei Yang" <richard.weiyang@gmail.com>,
"Matthew Wilcox" <willy@infradead.org>,
linux-kernel@vger.kernel.org, rust-for-linux@vger.kernel.org,
"Kees Cook" <kees@kernel.org>
Subject: Re: [PATCH v5 00/10] Add Rust linked list for reference counted values
Date: Fri, 23 Aug 2024 06:47:40 +0200 [thread overview]
Message-ID: <CANiq72=9dWLGjU6cTUWaqNPBXgs9CV1Lo_NDpLr3c-fOcfMgaA@mail.gmail.com> (raw)
In-Reply-To: <20240814-linked-list-v5-0-f5f5e8075da0@google.com>
On Wed, Aug 14, 2024 at 10:06 AM Alice Ryhl <aliceryhl@google.com> wrote:
>
> This patchset contains a Rust implementation of a doubly-linked list for
> use with reference counted values. Linked lists are famously hard to
> implement in Rust [1] given the cyclic nature of the pointers, and
> indeed, this implementation uses unsafe to get around that.
>
> Linked lists aren't great for cache locality reasons, but it can be hard
> to avoid them for cases where you need data structures that don't
> allocate. Most linked lists in Binder are for collections where order
> matters (usually stacks or queues). There are also a few lists that are
> just collections, but linked lists are only used for this purpose in
> cases where the linked list is cold and performance isn't that
> important. The linked list is chosen over Vec in this case so that I
> don't have to worry about reducing the capacity of the vector. (Our
> red/black trees are a much better place to look for improving cache
> locality of collections in Rust Binder, and the upcoming xarray bindings
> would help with that.)
>
> Please see the Rust Binder RFC [2] for usage examples.
>
> The linked lists are used all over Rust Binder, but some pointers for
> where to look for examples:
>
> [PATCH RFC 04/20] rust_binder: add work lists
> Implements the work lists that store heterogeneous items. Uses the
> various macros a bunch.
>
> [PATCH RFC 10/20] rust_binder: add death notifications
> Uses the cursor. Also has objects with multiple prev/next pointer pairs.
>
> [PATCH RFC 15/20] rust_binder: add process freezing
> Uses the iterator with for loops.
>
> Link: https://rust-unofficial.github.io/too-many-lists/ [1]
> Link: https://lore.kernel.org/rust-for-linux/20231101-rust-binder-v1-0-08ba9197f637@google.com/ [2]
> Signed-off-by: Alice Ryhl <aliceryhl@google.com>
Applied to `rust-next`-- thanks everyone!
[ Replaced `compile_fail` with `ignore` and a TODO note. Removed
`pub` from example to clean `unreachable_pub` lint. - Miguel ]
[ Fixed a few typos. - Miguel ]
Cheers,
Miguel
prev parent reply other threads:[~2024-08-23 4:47 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-14 8:05 [PATCH v5 00/10] Add Rust linked list for reference counted values Alice Ryhl
2024-08-14 8:05 ` [PATCH v5 01/10] rust: init: add `assert_pinned` macro Alice Ryhl
2024-08-14 8:05 ` [PATCH v5 02/10] rust: list: add ListArc Alice Ryhl
2024-08-14 8:05 ` [PATCH v5 03/10] rust: list: add tracking for ListArc Alice Ryhl
2024-08-14 8:05 ` [PATCH v5 04/10] rust: list: add struct with prev/next pointers Alice Ryhl
2024-08-14 8:05 ` [PATCH v5 05/10] rust: list: add macro for implementing ListItem Alice Ryhl
2024-08-14 8:05 ` [PATCH v5 06/10] rust: list: add List Alice Ryhl
2024-08-14 8:05 ` [PATCH v5 07/10] rust: list: add iterators Alice Ryhl
2024-08-14 8:05 ` [PATCH v5 08/10] rust: list: add cursor Alice Ryhl
2024-08-14 8:05 ` [PATCH v5 09/10] rust: list: support heterogeneous lists Alice Ryhl
2024-08-14 8:05 ` [PATCH v5 10/10] rust: list: add ListArcField Alice Ryhl
2024-08-23 4:47 ` Miguel Ojeda [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='CANiq72=9dWLGjU6cTUWaqNPBXgs9CV1Lo_NDpLr3c-fOcfMgaA@mail.gmail.com' \
--to=miguel.ojeda.sandonis@gmail.com \
--cc=a.hindborg@samsung.com \
--cc=akpm@linux-foundation.org \
--cc=alex.gaynor@gmail.com \
--cc=aliceryhl@google.com \
--cc=benno.lossin@proton.me \
--cc=bjorn3_gh@protonmail.com \
--cc=boqun.feng@gmail.com \
--cc=colyli@suse.de \
--cc=elver@google.com \
--cc=gary@garyguo.net \
--cc=kees@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=ojeda@kernel.org \
--cc=pabeni@redhat.com \
--cc=pierre.gondois@arm.com \
--cc=richard.weiyang@gmail.com \
--cc=rust-for-linux@vger.kernel.org \
--cc=wedsonaf@gmail.com \
--cc=willy@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;
as well as URLs for NNTP newsgroup(s).