lkml.org 
[lkml]   [2022]   [Sep]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 1/5] task_struct: Add field for per-task userspace scheduler hint
Date
- Add a field named "hint" to store the per-task userspace scheduler
hint set via the prctl() interface.
- Hints are inherited from parent on fork. Inherited hints can be reset
from the same prctl() interface used to set hint to default or any
other value.
- Hints are best effort case and scheduler doesn't make any guarantees
of strictly adhering to it.

Signed-off-by: K Prateek Nayak <kprateek.nayak@amd.com>
---
include/linux/sched.h | 1 +
init/init_task.c | 1 +
2 files changed, 2 insertions(+)

diff --git a/include/linux/sched.h b/include/linux/sched.h
index e7b2f8a5c711..fc953c9e956a 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -769,6 +769,7 @@ struct task_struct {
int wake_cpu;
#endif
int on_rq;
+ unsigned int hint;

int prio;
int static_prio;
diff --git a/init/init_task.c b/init/init_task.c
index ff6c4b9bfe6b..f5208e6a1934 100644
--- a/init/init_task.c
+++ b/init/init_task.c
@@ -79,6 +79,7 @@ struct task_struct init_task
.static_prio = MAX_PRIO - 20,
.normal_prio = MAX_PRIO - 20,
.policy = SCHED_NORMAL,
+ .hint = 0,
.cpus_ptr = &init_task.cpus_mask,
.user_cpus_ptr = NULL,
.cpus_mask = CPU_MASK_ALL,
--
2.25.1
\
 
 \ /
  Last update: 2022-09-10 12:54    [W:0.198 / U:0.060 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site