[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZMcj0TswxyCu5hpd@boqun-archlinux>
Date: Sun, 30 Jul 2023 20:00:33 -0700
From: Boqun Feng <boqun.feng@...il.com>
To: Benno Lossin <benno.lossin@...ton.me>
Cc: Miguel Ojeda <ojeda@...nel.org>,
Wedson Almeida Filho <wedsonaf@...il.com>,
Alex Gaynor <alex.gaynor@...il.com>,
Gary Guo <gary@...yguo.net>,
Björn Roy Baron <bjorn3_gh@...tonmail.com>,
Alice Ryhl <aliceryhl@...gle.com>,
Andreas Hindborg <nmi@...aspace.dk>,
rust-for-linux@...r.kernel.org, linux-kernel@...r.kernel.org,
Asahi Lina <lina@...hilina.net>
Subject: Re: [PATCH v3 08/13] rust: init: Add functions to create array
initializers
On Sat, Jul 29, 2023 at 09:10:02AM +0000, Benno Lossin wrote:
[...]
> +/// Initializes an array by initializing each element via the provided initializer.
> +///
> +/// # Examples
> +///
> +/// ```rust
> +/// use kernel::{sync::{Arc, Mutex}, init::pin_init_array_from_fn, new_mutex};
> +/// let array: Arc<[Mutex<usize>; 1_000_000_000]>=
This is nice, but (if I got my math correct) it requires ~30G memory on
a 64bit machine, and when this example got generated as a kunit test,
my poor VM took forever to finish it ;-) ;-) ;-) Maybe descrease it to,
say, 1000?
Regards,
Boqun
> +/// Arc::pin_init(pin_init_array_from_fn(|i| new_mutex!(i))).unwrap();
> +/// assert_eq!(array.len(), 1_000_000_000);
> +/// ```
[...]
Powered by blists - more mailing lists