lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250724161625.2360309-8-prakash.sangappa@oracle.com>
Date: Thu, 24 Jul 2025 16:16:21 +0000
From: Prakash Sangappa <prakash.sangappa@...cle.com>
To: linux-kernel@...r.kernel.org
Cc: peterz@...radead.org, rostedt@...dmis.org, mathieu.desnoyers@...icios.com,
        tglx@...utronix.de, bigeasy@...utronix.de, kprateek.nayak@....com,
        vineethr@...ux.ibm.com, prakash.sangappa@...cle.com
Subject: [PATCH V7 07/11] sched: Add API to indicate not to delay scheduling

Add an API for user threads to request scheduler to not delay
scheduling it when woken up to run. This is allowed only for RT threads.

Suggested-by: Thomas Gleixner <tglx@...utronix.de>
Signed-off-by: Prakash Sangappa <prakash.sangappa@...cle.com>
---
 include/linux/sched.h      |  1 +
 include/uapi/linux/prctl.h |  3 +++
 kernel/sys.c               | 18 ++++++++++++++++++
 3 files changed, 22 insertions(+)

diff --git a/include/linux/sched.h b/include/linux/sched.h
index 5c5868c555f0..3e8eb64658d1 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -1062,6 +1062,7 @@ struct task_struct {
 #endif
 	unsigned			in_nf_duplicate:1;
 	unsigned			rseq_delay_resched:2;
+	unsigned			sched_nodelay:1;
 #ifdef CONFIG_PREEMPT_RT
 	struct netdev_xmit		net_xmit;
 #endif
diff --git a/include/uapi/linux/prctl.h b/include/uapi/linux/prctl.h
index 6f9912c65595..907300cd4469 100644
--- a/include/uapi/linux/prctl.h
+++ b/include/uapi/linux/prctl.h
@@ -379,4 +379,7 @@ struct prctl_mm_map {
 # define PR_FUTEX_HASH_GET_SLOTS	2
 # define PR_FUTEX_HASH_GET_IMMUTABLE	3
 
+/* TASK sched nodelay request */
+#define PR_SET_SCHED_NODELAY		79
+#define PR_GET_SCHED_NODELAY		80
 #endif /* _LINUX_PRCTL_H */
diff --git a/kernel/sys.c b/kernel/sys.c
index a088a6b1ac23..2f8b4512c6e4 100644
--- a/kernel/sys.c
+++ b/kernel/sys.c
@@ -2890,6 +2890,24 @@ SYSCALL_DEFINE5(prctl, int, option, unsigned long, arg2, unsigned long, arg3,
 	case PR_FUTEX_HASH:
 		error = futex_hash_prctl(arg2, arg3, arg4);
 		break;
+	case PR_SET_SCHED_NODELAY:
+		if (arg3 || arg4 || arg5)
+			return -EINVAL;
+		if (current->sched_class != &rt_sched_class)
+			return -EINVAL;
+		if (arg2)
+			current->sched_nodelay = 1;
+		else
+			current->sched_nodelay = 0;
+		break;
+	case PR_GET_SCHED_NODELAY:
+		if (arg2 || arg3 || arg4 || arg5)
+			return -EINVAL;
+		if (current->sched_class != &rt_sched_class)
+			return -EINVAL;
+		error = (current->sched_nodelay == 1);
+		break;
+
 	default:
 		trace_task_prctl_unknown(option, arg2, arg3, arg4, arg5);
 		error = -EINVAL;
-- 
2.43.5


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ