All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/2] add Rust version of might_sleep()
@ 2025-04-10 22:56 FUJITA Tomonori
  2025-04-10 22:56 ` [PATCH v2 1/2] sched/core: Add __might_sleep_precision() FUJITA Tomonori
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: FUJITA Tomonori @ 2025-04-10 22:56 UTC (permalink / raw)
  To: linux-kernel, rust-for-linux
  Cc: boqun.feng, ojeda, alex.gaynor, gary, bjorn3_gh, benno.lossin,
	a.hindborg, aliceryhl, tmgross, dakr, mingo, peterz, juri.lelli,
	vincent.guittot, dietmar.eggemann, rostedt, bsegall, mgorman,
	vschneid, pmladek

This patchset adds Rust version of might_sleep().

These patches were previously part of the IO polling patchset [1], but
they were split out to make upstreaming easier.

The first patch is for sched/core, which adds
__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. Providing a null-terminated
string for better C interoperability is under discussion [2].

The second patch adds a Rust implementation of might_sleep(), on top
of the changes in the first patch.

[1]: https://lore.kernel.org/lkml/20250220070611.214262-1-fujita.tomonori@gmail.com/
[2]: https://github.com/rust-lang/libs-team/issues/466

v2:
- improve SAFETY comment
v1: https://lore.kernel.org/lkml/20250406110718.126146-1-fujita.tomonori@gmail.com/

FUJITA Tomonori (2):
  sched/core: Add __might_sleep_precision()
  rust: task: add Rust version of might_sleep()

 include/linux/kernel.h |  2 ++
 kernel/sched/core.c    | 62 ++++++++++++++++++++++++++++--------------
 rust/helpers/task.c    |  6 ++++
 rust/kernel/task.rs    | 28 +++++++++++++++++++
 4 files changed, 77 insertions(+), 21 deletions(-)


base-commit: 0af2f6be1b4281385b618cb86ad946eded089ac8
-- 
2.43.0


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2025-04-22 14:31 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-10 22:56 [PATCH v2 0/2] add Rust version of might_sleep() FUJITA Tomonori
2025-04-10 22:56 ` [PATCH v2 1/2] sched/core: Add __might_sleep_precision() FUJITA Tomonori
2025-04-10 22:56 ` [PATCH v2 2/2] rust: task: add Rust version of might_sleep() FUJITA Tomonori
2025-04-11  9:11   ` Alice Ryhl
2025-04-22 14:30 ` [PATCH v2 0/2] " Boqun Feng
2025-04-22 14:31   ` Peter Zijlstra

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.