From: Parth Shah <parth@linux.ibm.com>
To: linux-kernel@vger.kernel.org
Cc: peterz@infradead.org, mingo@redhat.com,
vincent.guittot@linaro.org, dietmar.eggemann@arm.com,
qais.yousef@arm.com, chris.hyser@oracle.com,
patrick.bellasi@matbug.net, valentin.schneider@arm.com,
David.Laight@ACULAB.COM, pjt@google.com, pavel@ucw.cz,
tj@kernel.org, dhaval.giani@oracle.com, qperret@google.com,
tim.c.chen@linux.intel.com
Subject: [PATCH v4 1/4] sched: Introduce latency-nice as a per-task attribute
Date: Mon, 24 Feb 2020 14:29:15 +0530 [thread overview]
Message-ID: <20200224085918.16955-2-parth@linux.ibm.com> (raw)
In-Reply-To: <20200224085918.16955-1-parth@linux.ibm.com>
Latency-nice indicates the latency requirements of a task with respect
to the other tasks in the system. The value of the attribute can be within
the range of [-20, 19] both inclusive to be in-line with the values just
like task nice values.
latency_nice = -20 indicates the task to have the least latency as
compared to the tasks having latency_nice = +19.
The latency_nice may affect only the CFS SCHED_CLASS by getting
latency requirements from the userspace.
Signed-off-by: Parth Shah <parth@linux.ibm.com>
Reviewed-by: Qais Yousef <qais.yousef@arm.com>
---
include/linux/sched.h | 1 +
kernel/sched/sched.h | 18 ++++++++++++++++++
2 files changed, 19 insertions(+)
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 467d26046416..0668948fddcd 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -676,6 +676,7 @@ struct task_struct {
int static_prio;
int normal_prio;
unsigned int rt_priority;
+ int latency_nice;
const struct sched_class *sched_class;
struct sched_entity se;
diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
index 878910e8b299..26b9758075e4 100644
--- a/kernel/sched/sched.h
+++ b/kernel/sched/sched.h
@@ -101,6 +101,24 @@ extern long calc_load_fold_active(struct rq *this_rq, long adjust);
*/
#define NS_TO_JIFFIES(TIME) ((unsigned long)(TIME) / (NSEC_PER_SEC / HZ))
+/*
+ * Latency nice is meant to provide scheduler hints about the relative
+ * latency requirements of a task with respect to other tasks.
+ * Thus a task with latency_nice == 19 can be hinted as the task with no
+ * latency requirements, in contrast to the task with latency_nice == -20
+ * which should be given priority in terms of lower latency.
+ */
+#define MAX_LATENCY_NICE 19
+#define MIN_LATENCY_NICE -20
+
+#define LATENCY_NICE_WIDTH \
+ (MAX_LATENCY_NICE - MIN_LATENCY_NICE + 1)
+
+/*
+ * Default tasks should be treated as a task with latency_nice = 0.
+ */
+#define DEFAULT_LATENCY_NICE 0
+
/*
* Increase resolution of nice-level calculations for 64-bit architectures.
* The extra resolution improves shares distribution and load balancing of
--
2.17.2
next prev parent reply other threads:[~2020-02-24 8:59 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-24 8:59 [PATCH v4 0/4] Introduce per-task latency_nice for scheduler hints Parth Shah
2020-02-24 8:59 ` Parth Shah [this message]
2020-02-24 8:59 ` [PATCH v4 2/4] sched/core: Propagate parent task's latency requirements to the child task Parth Shah
2020-02-25 6:32 ` Pavan Kondeti
2020-02-25 8:16 ` Parth Shah
2020-02-24 8:59 ` [PATCH v4 3/4] sched: Allow sched_{get,set}attr to change latency_nice of the task Parth Shah
2020-02-25 6:54 ` Pavan Kondeti
2020-02-25 15:03 ` Parth Shah
2020-02-26 3:44 ` Pavan Kondeti
2020-02-24 8:59 ` [PATCH v4 4/4] sched/core: Add permission checks for setting the latency_nice value Parth Shah
2020-02-24 13:29 ` Qais Yousef
2020-02-25 6:47 ` Parth Shah
2020-02-27 11:44 ` Qais Yousef
2020-02-27 14:46 ` chris hyser
2020-02-24 23:08 ` chris hyser
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200224085918.16955-2-parth@linux.ibm.com \
--to=parth@linux.ibm.com \
--cc=David.Laight@ACULAB.COM \
--cc=chris.hyser@oracle.com \
--cc=dhaval.giani@oracle.com \
--cc=dietmar.eggemann@arm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=patrick.bellasi@matbug.net \
--cc=pavel@ucw.cz \
--cc=peterz@infradead.org \
--cc=pjt@google.com \
--cc=qais.yousef@arm.com \
--cc=qperret@google.com \
--cc=tim.c.chen@linux.intel.com \
--cc=tj@kernel.org \
--cc=valentin.schneider@arm.com \
--cc=vincent.guittot@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome