aboutsummaryrefslogtreecommitdiffstats
path: root/rust/helpers/task.c
diff options
context:
space:
mode:
authorFUJITA Tomonori <[email protected]>2025-04-10 22:56:23 +0000
committerBoqun Feng <[email protected]>2025-06-24 22:53:50 +0000
commit7e611710acf966df1e14bcf4e067385e38e549a1 (patch)
tree5b1f4f5f388d91bfed5daaa1da7b99a53a7c7936 /rust/helpers/task.c
parentrust: Introduce file_from_location() (diff)
downloadkernel-7e611710acf966df1e14bcf4e067385e38e549a1.tar.gz
kernel-7e611710acf966df1e14bcf4e067385e38e549a1.zip
rust: task: Add Rust version of might_sleep()
Add a helper function equivalent to the C's might_sleep(), which serves as a debugging aid and a potential scheduling point. Note that this function can only be used in a nonatomic context. This will be used by Rust version of read_poll_timeout(). [boqun: Use file_from_location() to get a C string instead of changing __might_sleep()] Signed-off-by: FUJITA Tomonori <[email protected]> Reviewed-by: Alice Ryhl <[email protected]> Signed-off-by: Boqun Feng <[email protected]> Link: https://lore.kernel.org/r/[email protected]
Diffstat (limited to 'rust/helpers/task.c')
-rw-r--r--rust/helpers/task.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/rust/helpers/task.c b/rust/helpers/task.c
index 31c33ea2dce6..2c85bbc2727e 100644
--- a/rust/helpers/task.c
+++ b/rust/helpers/task.c
@@ -1,7 +1,13 @@
// SPDX-License-Identifier: GPL-2.0
+#include <linux/kernel.h>
#include <linux/sched/task.h>
+void rust_helper_might_resched(void)
+{
+ might_resched();
+}
+
struct task_struct *rust_helper_get_current(void)
{
return current;