mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andreas Hindborg <a.hindborg@kernel.org>
To: Vitaly Wool <vitaly.wool@konsulko.se>,
	Jens Axboe <axboe@kernel.dk>, Miguel Ojeda <ojeda@kernel.org>,
	Alice Ryhl <aliceryhl@google.com>
Cc: "Boqun Feng" <boqun@kernel.org>, "Gary Guo" <gary@garyguo.net>,
	"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
	"Benno Lossin" <lossin@kernel.org>,
	"Trevor Gross" <tmgross@umich.edu>,
	"Danilo Krummrich" <dakr@kernel.org>,
	"Daniel Almeida" <daniel.almeida@collabora.com>,
	"Tamir Duberstein" <tamird@kernel.org>,
	"Alexandre Courbot" <acourbot@nvidia.com>,
	"Onur Özkan" <work@onurozkan.dev>,
	"Lorenzo Stoakes" <ljs@kernel.org>,
	"Liam R . Howlett" <liam@infradead.org>,
	linux-block@vger.kernel.org, rust-for-linux@vger.kernel.org,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	"Igor B" <igor.b@beldev.am>,
	"Vitaly Wool" <vitaly.wool@konsulko.se>
Subject: Re: [PATCH 2/3] rust: page: add reference counting, raw pointers and a private bit lock
Date: Wed, 18 Nov 2026 16:23:40 +0100	[thread overview]
Message-ID: <877biaups3.fsf@t14s.mail-host-address-is-not-set> (raw)
In-Reply-To: <20261117233211.3137168-3-vitaly.wool@konsulko.se>

"Vitaly Wool" <vitaly.wool@konsulko.se> writes:

> From: Igor B <igor.b@beldev.am>
>
> A `Page` always owns its page exclusively, with no way to take another
> reference or keep it as a raw pointer. Add:
>
> - `Page::get()`, which takes another reference with `get_page()`;
> - `Page::into_raw()` and `Page::from_raw()`, to convert a `Page` to and
>   from the `struct page` pointer it holds a reference to;
> - `Page::try_get_raw()`, which takes a reference from a possibly stale
>   pointer with `get_page_unless_zero()`, for lock-free lookups like
>   brd_lookup_page(). This is sound because a `struct page` is never
>   freed, even once its memory is;
> - `Page::lock_private_bit()`, which takes a bit spinlock in the page's
>   `private` field and returns a guard that releases it. This gives a
>   page used as plain memory a lock of its own at no memory cost.
>
> Add Rust helpers for `get_page()`, `get_page_unless_zero()`,
> `bit_spin_lock()` and `bit_spin_unlock()`.
>
> This patch was tested with the help of  Claude Code AI coding assistant.
>
> Signed-off-by: Igor Belousov <igor.b@beldev.am>
> Signed-off-by: Vitaly Wool <vitaly.wool@konsulko.se>

I already submitted most of this as part of the `Ownable` work [1]. I
sent v22 of the `Ownable` series a few days ago [2]. I stripped out the
page stuff to send as a separate series. I plan to send the page things
this week. It covers both reference counted pages and frozen pages.

Best regards,
Andreas Hindborg

[1] https://lore.kernel.org/all/20260910-unique-ref-v21-0-e83257373062@kernel.org/
[2] https://lore.kernel.org/all/20261116-unique-ref-v22-0-12029383206d@kernel.org/


  reply	other threads:[~2026-11-18 15:24 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-17 23:32 [PATCH 0/3] rust: block: add rbrd, a RAM backed block driver Vitaly Wool
2026-11-17 23:32 ` [PATCH 1/3] rust: block: add bio segment iteration and request accessors Vitaly Wool
2026-11-18 15:19   ` Andreas Hindborg
2026-11-17 23:32 ` [PATCH 2/3] rust: page: add reference counting, raw pointers and a private bit lock Vitaly Wool
2026-11-18 15:23   ` Andreas Hindborg [this message]
2026-11-17 23:32 ` [PATCH 3/3] rust: block: add rbrd, a RAM backed block driver Vitaly Wool
2026-11-18 11:43 ` [PATCH 0/3] " Jan Engelhardt
2026-11-18 14:48   ` Vitaly Wool

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=877biaups3.fsf@t14s.mail-host-address-is-not-set \
    --to=a.hindborg@kernel.org \
    --cc=acourbot@nvidia.com \
    --cc=aliceryhl@google.com \
    --cc=axboe@kernel.dk \
    --cc=bjorn3_gh@protonmail.com \
    --cc=boqun@kernel.org \
    --cc=dakr@kernel.org \
    --cc=daniel.almeida@collabora.com \
    --cc=gary@garyguo.net \
    --cc=igor.b@beldev.am \
    --cc=liam@infradead.org \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=ljs@kernel.org \
    --cc=lossin@kernel.org \
    --cc=ojeda@kernel.org \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=tamird@kernel.org \
    --cc=tmgross@umich.edu \
    --cc=vitaly.wool@konsulko.se \
    --cc=work@onurozkan.dev \
    /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®