[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20250224.104025.43839253856223839.fujita.tomonori@gmail.com>
Date: Mon, 24 Feb 2025 10:40:25 +0900 (JST)
From: FUJITA Tomonori <fujita.tomonori@...il.com>
To: mingo@...hat.com, peterz@...radead.org, juri.lelli@...hat.com,
vincent.guittot@...aro.org
Cc: linux-kernel@...r.kernel.org, daniel.almeida@...labora.com,
aliceryhl@...gle.com, boqun.feng@...il.com,
rust-for-linux@...r.kernel.org, netdev@...r.kernel.org, andrew@...n.ch,
hkallweit1@...il.com, tmgross@...ch.edu, ojeda@...nel.org,
alex.gaynor@...il.com, gary@...yguo.net, bjorn3_gh@...tonmail.com,
benno.lossin@...ton.me, a.hindborg@...sung.com, anna-maria@...utronix.de,
frederic@...nel.org, tglx@...utronix.de, arnd@...db.de,
jstultz@...gle.com, sboyd@...nel.org, dietmar.eggemann@....com,
rostedt@...dmis.org, bsegall@...gle.com, mgorman@...e.de,
vschneid@...hat.com, tgunders@...hat.com, me@...enk.dev,
david.laight.linux@...il.com
Subject: Re: [PATCH v11 1/8] sched/core: Add __might_sleep_precision()
On Thu, 20 Feb 2025 16:06:03 +0900
FUJITA Tomonori <fujita.tomonori@...il.com> wrote:
> Add __might_sleep_precision(), Rust friendly version of
> __might_sleep(), which takes a pointer to a string with the length
> instead of a null-terminated string.
>
> Rust's core::panic::Location::file(), which gives the file name of a
> caller, doesn't provide a null-terminated
> string. __might_sleep_precision() uses a precision specifier in the
> printk format, which specifies the length of a string; a string
> doesn't need to be a null-terminated.
>
> Modify __might_sleep() to call __might_sleep_precision() but the
> impact should be negligible. When printing the error (sleeping
> function called from invalid context), the precision string format is
> used instead of the simple string format; the precision specifies the
> the maximum length of the displayed string.
>
> Note that Location::file() providing a null-terminated string for
> better C interoperability is under discussion [1].
>
> [1]: https://github.com/rust-lang/libs-team/issues/466
>
> Tested-by: Daniel Almeida <daniel.almeida@...labora.com>
> Reviewed-by: Alice Ryhl <aliceryhl@...gle.com>
> Co-developed-by: Boqun Feng <boqun.feng@...il.com>
> Signed-off-by: Boqun Feng <boqun.feng@...il.com>
> Signed-off-by: FUJITA Tomonori <fujita.tomonori@...il.com>
> ---
> include/linux/kernel.h | 2 ++
> kernel/sched/core.c | 61 +++++++++++++++++++++++++++---------------
> 2 files changed, 42 insertions(+), 21 deletions(-)
SCHEDULER maintainers,
Can I get an ack for this? Or you prefer a different approach?
Powered by blists - more mailing lists