linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Tamir Duberstein <tamird@kernel.org>
To: Alvin Sun <alvin.sun@linux.dev>
Cc: "Matthew Wilcox" <willy@infradead.org>,
	"Miguel Ojeda" <ojeda@kernel.org>,
	"Boqun Feng" <boqun@kernel.org>, "Gary Guo" <gary@garyguo.net>,
	"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
	"Benno Lossin" <lossin@kernel.org>,
	"Andreas Hindborg" <a.hindborg@kernel.org>,
	"Alice Ryhl" <aliceryhl@google.com>,
	"Trevor Gross" <tmgross@umich.edu>,
	"Danilo Krummrich" <dakr@kernel.org>,
	"Lorenzo Stoakes" <ljs@kernel.org>,
	"Liam R. Howlett" <Liam.Howlett@oracle.com>,
	rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-mm@kvack.org, "Onur Özkan" <work@onurozkan.dev>
Subject: Re: [PATCH 4/4] rust: xarray: Add Guard::find() helper
Date: Fri, 17 Apr 2026 10:52:29 -0400	[thread overview]
Message-ID: <CAJ-ks9=veRG_8SZ7CyzqdR2RhtJ6QZWozyo8oc-xnwoqpCdg6g@mail.gmail.com> (raw)
In-Reply-To: <df183bfe-21b9-4393-902d-18835e0bcf48@linux.dev>

On Thu, Apr 16, 2026 at 10:17 PM Alvin Sun <alvin.sun@linux.dev> wrote:
>
>
> On 4/17/26 09:18, Matthew Wilcox wrote:
> > On Fri, Apr 17, 2026 at 09:05:54AM +0800, Alvin Sun wrote:
> >> Add a helper to find the first present entry in the XArray.
> > Why would you expose a function which does striclty less than the
> > underlying C implementation, rather than exposing all the functionality
> > that xa_find does?
> >
> >> Returns the index of the first present entry, or None if the array
> >> is empty.
> > Why not return the value found, like xa_find() does?
>
> Hi Matthew,
>
> Thanks for the feedback! I had considered both returning a tuple (key,
> &value)
> and an Entry struct, but only returned the key since that's all Tyr
> currently
> needs. I'll look at other Rust code to see which approach fits better, then
> implement it properly in v2.
>
> Best regards,
> Alvin
>
> >
> > This is all very troubling.  I don't think Rust should depart from
> > what C has without good reason.
> >

More complete wrappers around the C APIs exist in Andreas'
https://lore.kernel.org/all/20260209-xarray-entry-send-v3-0-f777c65b8ae2@kernel.org/.
Perhaps we can borrow from that series?


  reply	other threads:[~2026-04-17 14:53 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-17  1:05 [PATCH 0/4] rust: Add helper functions and constants for Tyr driver Alvin Sun
2026-04-17  1:05 ` [PATCH 1/4] rust: sizes: add SZ_4G constant Alvin Sun
2026-04-17  3:18   ` Alexandre Courbot
2026-04-17 11:56     ` Alvin Sun
2026-04-17 14:06       ` Alexandre Courbot
2026-04-17 15:06         ` Alvin Sun
2026-04-17  1:05 ` [PATCH 2/4] rust: mm: Add task_size() method to Mm Alvin Sun
2026-04-17  1:05 ` [PATCH 3/4] rust: xarray: Update StoreError comments for alloc() Alvin Sun
2026-04-17  1:05 ` [PATCH 4/4] rust: xarray: Add Guard::find() helper Alvin Sun
2026-04-17  1:18   ` Matthew Wilcox
2026-04-17  2:16     ` Alvin Sun
2026-04-17 14:52       ` Tamir Duberstein [this message]
2026-04-17 15:11         ` Alvin Sun
2026-04-17  8:28   ` Onur Özkan
2026-04-17 12:43     ` Alvin Sun
2026-04-17  7:43 ` [PATCH 0/4] rust: Add helper functions and constants for Tyr driver Onur Özkan
2026-04-17 12:44   ` Alvin Sun

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='CAJ-ks9=veRG_8SZ7CyzqdR2RhtJ6QZWozyo8oc-xnwoqpCdg6g@mail.gmail.com' \
    --to=tamird@kernel.org \
    --cc=Liam.Howlett@oracle.com \
    --cc=a.hindborg@kernel.org \
    --cc=aliceryhl@google.com \
    --cc=alvin.sun@linux.dev \
    --cc=bjorn3_gh@protonmail.com \
    --cc=boqun@kernel.org \
    --cc=dakr@kernel.org \
    --cc=gary@garyguo.net \
    --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=tmgross@umich.edu \
    --cc=willy@infradead.org \
    --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