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: <20241113000126.967713-4-prakash.sangappa@oracle.com>
Date: Wed, 13 Nov 2024 00:01:25 +0000
From: Prakash Sangappa <prakash.sangappa@...cle.com>
To: linux-kernel@...r.kernel.org
Cc: rostedt@...dmis.org, peterz@...radead.org, tglx@...utronix.de,
        daniel.m.jordan@...cle.com, prakash.sangappa@...cle.com
Subject: [RFC PATCH 3/4] Indicate if schedular preemption delay request is granted

Indicate to user space if the preemption delay request was granted
or denied.

Signed-off-by: Prakash Sangappa <prakash.sangappa@...cle.com>
---
 include/uapi/linux/task_shared.h | 11 +++++++++++
 mm/task_shared.c                 | 14 +++++++++++---
 2 files changed, 22 insertions(+), 3 deletions(-)

diff --git a/include/uapi/linux/task_shared.h b/include/uapi/linux/task_shared.h
index 6e4c664eea60..a0f7ef0c69d0 100644
--- a/include/uapi/linux/task_shared.h
+++ b/include/uapi/linux/task_shared.h
@@ -15,4 +15,15 @@
 struct task_sharedinfo {
 		volatile unsigned short sched_delay;
 };
+
+/*
+ * 'sched_delay'  values:
+ * TASK_PREEMPT_DELAY_REQ - application sets to request preemption delay.
+ * TASK_PREEMPT_DELAY_GRANTED - set by kernel if granted extended time on cpu.
+ * TASK_PREEMPT_DELAY_DENIED- set by kernel if not granted because the
+ *     application requested preemption delay again within the extended time.
+ */
+#define TASK_PREEMPT_DELAY_REQ		1
+#define TASK_PREEMPT_DELAY_GRANTED	2
+#define TASK_PREEMPT_DELAY_DENIED	3
 #endif
diff --git a/mm/task_shared.c b/mm/task_shared.c
index 575b335d6879..5b8a068a6b44 100644
--- a/mm/task_shared.c
+++ b/mm/task_shared.c
@@ -279,13 +279,21 @@ bool taskshrd_delay_resched(void)
 	if(shrdp == NULL || shrdp->kaddr == NULL)
 		return false;
 
-	if (t->taskshrd_sched_delay)
+	if (t->taskshrd_sched_delay) {
+		if (shrdp->kaddr->ts.sched_delay
+				== TASK_PREEMPT_DELAY_REQ) {
+			/* not granted */
+			shrdp->kaddr->ts.sched_delay
+				= TASK_PREEMPT_DELAY_DENIED;
+		}
 		return false;
+	}
 
-	if (!(shrdp->kaddr->ts.sched_delay))
+	if (shrdp->kaddr->ts.sched_delay != TASK_PREEMPT_DELAY_REQ)
 		return false;
 
-	shrdp->kaddr->ts.sched_delay = 0;
+	/* granted */
+	shrdp->kaddr->ts.sched_delay = TASK_PREEMPT_DELAY_GRANTED;
 	t->taskshrd_sched_delay = 1;
 
 	return true;
-- 
2.43.5


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ