rust-for-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@infradead.org>
To: Kent Overstreet <kent.overstreet@linux.dev>
Cc: lsf-pc@lists.linux-foundation.org, linux-fsdevel@vger.kernel.org,
	rust-for-linux@vger.kernel.org,
	Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>,
	Alice Ryhl <aliceryhl@google.com>,
	Wedson Almeida Filho <wedsonaf@gmail.com>,
	Alexander Viro <viro@zeniv.linux.org.uk>,
	Christian Brauner <brauner@kernel.org>,
	Kees Cook <keescook@chromium.org>, Gary Guo <gary@garyguo.net>,
	Dave Chinner <dchinner@redhat.com>,
	David Howells <dhowells@redhat.com>,
	Ariel Miculas <amiculas@cisco.com>,
	Paul McKenney <paulmck@kernel.org>
Subject: Re: [LSF/MM TOPIC] Rust
Date: Tue, 23 Jan 2024 19:09:37 +0000	[thread overview]
Message-ID: <ZbAO8REoMbxWjozR@casper.infradead.org> (raw)
In-Reply-To: <wjtuw2m3ojn7m6gx2ozyqtvlsetzwxv5hdhg2hocal3gyou3ue@34e37oox4d5m>

On Mon, Jan 22, 2024 at 11:23:51PM -0500, Kent Overstreet wrote:
> There's been ongoing work on safe Rust interfaces to the VFS, as well as
> whole new filesystems in Rust (tarfs, puzzlefs), and talk of adding Rust
> code for existing filesystems (bcachefs, any day now, I swear).

I really want this to happen.  It's taken 50 years, but we finally have
a programming language that can replace C for writing kernels.

> Possible subtopics:
>  - Braces, brackets and arrow signs: does Rust have enough of them, too
>    many, or both?

Um.  Maybe we should limit ourselves to productive discussions
that will affect the MM/filesystems/storage/bpf subsystems?
While it's entertaining to read about Rust-as-it-might-have-been
https://graydon2.dreamwidth.org/307291.html I quickly get lost in trying
to learn the last three decades of language design to understand all
the points being made.

>  - Obeying the borrow checker: C programmers are widely renouned for
>    creative idiosyncrasies in pointer based data structures; structure
>    design; will we be able to fully express our creativity within Rust?
>    Or are there VFS abstractions and lifetime rules that will be
>    difficult to translate?
> 
>  - Perhaps there are annoying VFS rules that in the past required hand
>    tattoos to remember, but we'll now be able to teach the compiler to
>    remember for us?
> 
>    (idmapping comes to mind as one area where we've recently been able
>    to increase safety through effective use of the type system - this is
>    about way more than just use-after-free bugs)
> 
>  - Moving objects around in memory: Rust rather dislikes being told
>    objects can't be moved around (a consequence of algebraic data
>    types), and this has been a source of no small amount of frustration
>    on the Rust side of things. Could we on the C side perhaps find ways
>    to relax their constraints? (object pinning, versus e.g. perhaps
>    making it possible to move a list head around)

Death To List Heads!  They're the perfect data structure for a 1995
era CPU.  They leave 90% of your CPUs performance on the table if you
bought your CPU in the last five years.  If list heads make rust sad,
then that's just one more reason to abolish them.

>  - The use of outside library code: Historically, C code was either
>    written for userspace or the kernel, and not both. But that's not
>    particularly true in Rust land (and getting to be less true even in C
>    land); should we consider some sort of structure or (cough) package
>    management? Is it time to move beyond ye olde cut-and-paste?

Rust has a package manager.  I don't think we need kCargo.  I'm not
deep enough in the weeds on this to make sensible suggestions, but if
a package (eg a crypto suite or compression library) doesn't depend on
anything ridiculous then what's the harm in just pulling it in?

> The Rust-for-Linux people have been great - let's see if we can get them
> to join us in Utah this year, I think they'll have things to teach us.

It's definitely a two-way conversation.  There's too much for any one
person to know, so teaching each other what "we" need "them" to know
is a great thing.  I hear some people are considering pitching sessions
like "What filesystem people get wrong about MM", "The pagecache doesn't
work the way you think it does" and "Why directio and the pagecache are
mortal enemies".  And I'm in favour of those kinds of sessions (as long
as I don't end up leading five sessions again ...).

  reply	other threads:[~2024-01-23 19:09 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-23  4:23 [LSF/MM TOPIC] Rust Kent Overstreet
2024-01-23 19:09 ` Matthew Wilcox [this message]
2024-01-23 21:04   ` Boqun Feng
2024-01-24 14:26   ` James Bottomley
2024-01-24 15:43     ` Matthew Wilcox
2024-01-24 16:04       ` James Bottomley
2024-01-24 18:50         ` Kent Overstreet
2024-01-24 19:23           ` Morten Linderud
2024-01-24 19:43           ` James Bottomley
2024-01-24 19:57             ` Kent Overstreet
2024-01-25  3:47               ` James Bottomley
2024-01-25  9:24                 ` Kent Overstreet
2024-01-25 21:30                   ` James Bottomley
2024-01-23 22:58 ` David Howells
2024-01-24  3:57   ` Boqun Feng
2024-01-24 21:20   ` Kent Overstreet

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=ZbAO8REoMbxWjozR@casper.infradead.org \
    --to=willy@infradead.org \
    --cc=aliceryhl@google.com \
    --cc=amiculas@cisco.com \
    --cc=brauner@kernel.org \
    --cc=dchinner@redhat.com \
    --cc=dhowells@redhat.com \
    --cc=gary@garyguo.net \
    --cc=keescook@chromium.org \
    --cc=kent.overstreet@linux.dev \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=lsf-pc@lists.linux-foundation.org \
    --cc=miguel.ojeda.sandonis@gmail.com \
    --cc=paulmck@kernel.org \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    --cc=wedsonaf@gmail.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;
as well as URLs for NNTP newsgroup(s).