dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Andreas Hindborg" <a.hindborg@kernel.org>
Cc: linux-pci@vger.kernel.org, dri-devel@lists.freedesktop.org,
	gary@garyguo.net, ojeda@kernel.org
Subject: Re: [PATCH v21 7/9] rust: page: convert to `AlwaysRefCounted`
Date: Thu, 10 Sep 2026 09:18:48 +0000	[thread overview]
Message-ID: <20260910091848.E58701F00893@smtp.kernel.org> (raw)
In-Reply-To: <20260910-unique-ref-v21-7-e83257373062@kernel.org>

> `struct page` is managed by a native reference count, and kernel C
> code routinely takes its own references to pages, for example when a
> page is inserted into a VMA with `vm_insert_page()`.
> 
> Thus, implement `RefCounted` for `Page`, backed by `get_page()` and
> `put_page()`, mark it `AlwaysRefCounted`, and return `ARef<Page>` from
> `Page::alloc_page()`. The page is freed when the last reference to it is
> dropped; for the order-0 pages allocated here, this is equivalent to
> `__free_pages()`.
> 
> This also allows `Page` references to be returned as borrowed
> references without owning the `struct page`. Remove `BorrowedPage`
> and update users to use `&Page` and `ARef<Page>`.
> 
> Assisted-by: LLM
> Suggested-by: Alice Ryhl <aliceryhl@google.com>
> Signed-off-by: Andreas Hindborg <a.hindborg@kernel.org>

Sashiko has reviewed this patch and found no issues. It looks great!

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260910-unique-ref-v21-0-e83257373062@kernel.org?part=7


  reply	other threads:[~2026-09-10  9:18 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-10  9:00 [PATCH v21 0/9] rust: add `Ownable` trait and `Owned` type Andreas Hindborg
2026-09-10  9:00 ` [PATCH v21 1/9] rust: alloc: add `KBox::into_non_null` Andreas Hindborg
2026-09-10  9:05   ` sashiko-bot
2026-09-10  9:00 ` [PATCH v21 2/9] rust: types: Add Ownable/Owned types Andreas Hindborg
2026-09-10  9:06   ` sashiko-bot
2026-09-10  9:00 ` [PATCH v21 3/9] rust: implement `ForeignOwnable` for `Owned` Andreas Hindborg
2026-09-10  9:08   ` sashiko-bot
2026-09-10  9:00 ` [PATCH v21 4/9] rust: rename `AlwaysRefCounted` to `RefCounted` Andreas Hindborg
2026-09-10  9:14   ` sashiko-bot
2026-09-11  9:08   ` Alice Ryhl
2026-09-11 12:29     ` Gary Guo
2026-09-13  9:49       ` Andreas Hindborg
2026-09-10  9:00 ` [PATCH v21 5/9] rust: Add missing SAFETY documentation for `ARef` example Andreas Hindborg
2026-09-10  9:07   ` sashiko-bot
2026-09-11  9:09   ` Alice Ryhl
2026-09-10  9:00 ` [PATCH v21 6/9] rust: Add `OwnableRefCounted` Andreas Hindborg
2026-09-10  9:09   ` sashiko-bot
2026-09-11  9:19   ` Alice Ryhl
2026-09-11 13:25     ` Andreas Hindborg
2026-09-10  9:00 ` [PATCH v21 7/9] rust: page: convert to `AlwaysRefCounted` Andreas Hindborg
2026-09-10  9:18   ` sashiko-bot [this message]
2026-09-11 13:43   ` Alice Ryhl
2026-09-10  9:00 ` [PATCH v21 8/9] rust: page: add `from_raw()` Andreas Hindborg
2026-09-10  9:11   ` sashiko-bot
2026-09-10  9:00 ` [PATCH v21 9/9] rust: page: add `ExclusivePage` for race-free page access Andreas Hindborg
2026-09-10  9:14   ` sashiko-bot
2026-09-13  3:11   ` Matthew Wilcox
2026-09-13  9:36     ` Andreas Hindborg

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=20260910091848.E58701F00893@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=a.hindborg@kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=gary@garyguo.net \
    --cc=linux-pci@vger.kernel.org \
    --cc=ojeda@kernel.org \
    --cc=sashiko-reviews@lists.linux.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