Skip to contentSkip to conversation

sched-idleprio-1.9.patch

PATCH In review Con Kolivas 1 participant 1 message Jun 18, 2006 Scheduler

lore
Share & tools
lore
#0 lore raw

PATCH 9/29 sched-idleprio-1.9.patch

Add the SCHED_IDLEPRIO scheduling policy. Tasks set to this policy are only given cpu time if no other tasks at all wish to have cpu time thus running effectively at idle priority. If semaphores or mutexes are held, or the system is going into suspend, schedule them as SCHED_NORMAL nice 19.

 include/linux/init_task.h |    4 +-
 include/linux/sched.h     |    9 +++--
 kernel/sched.c            |   75 +++++++++++++++++++++++++++++++++++++++-------
 3 files changed, 72 insertions(+), 16 deletions(-)
include/linux/init_task.h +2 -2
Index: linux-ck-dev/include/linux/init_task.h
===================================================================
@@ -85,8 +85,8 @@ extern struct group_info init_groups;
 	.usage		= ATOMIC_INIT(2),				\
 	.flags		= 0,						\
 	.lock_depth	= -1,						\
-	.prio		= MAX_PRIO-20,					\
-	.static_prio	= MAX_PRIO-20,					\
+	.prio		= MAX_PRIO-21,					\
+	.static_prio	= MAX_PRIO-21,					\
 	.policy		= SCHED_NORMAL,					\
 	.cpus_allowed	= CPU_MASK_ALL,					\
 	.mm		= NULL,						\
include/linux/sched.h +6 -3
Index: linux-ck-dev/include/linux/sched.h
===================================================================
@@ -165,9 +165,10 @@ extern unsigned long weighted_cpuload(co
 #define SCHED_RR		2
 #define SCHED_BATCH		3
 #define SCHED_ISO		4
+#define SCHED_IDLEPRIO		5
 
 #define SCHED_MIN		0
-#define SCHED_MAX		4
+#define SCHED_MAX		5
 
 #define SCHED_RANGE(policy)	((policy) <= SCHED_MAX)
 #define SCHED_RT(policy)	((policy) == SCHED_FIFO || \
@@ -492,12 +493,14 @@ struct signal_struct {
 #define MAX_RT_PRIO		MAX_USER_RT_PRIO
 #define ISO_PRIO		(MAX_RT_PRIO - 1)
 
-#define MAX_PRIO		(MAX_RT_PRIO + 40)
-#define MIN_USER_PRIO		(MAX_PRIO - 1)
+#define MAX_PRIO		(MAX_RT_PRIO + 41)
+#define MIN_USER_PRIO		(MAX_PRIO - 2)
+#define IDLEPRIO_PRIO		(MAX_PRIO - 1)
 
 #define rt_task(p)		(unlikely(SCHED_RT((p)->policy)))
 #define batch_task(p)		(unlikely((p)->policy == SCHED_BATCH))
 #define iso_task(p)		(unlikely((p)->policy == SCHED_ISO))
+#define idleprio_task(p)	(unlikely((p)->policy == SCHED_IDLEPRIO))
 
 /*
  * Some day this will be a full-fledged user tracking system..
kernel/sched.c +64 -11

151 lines not on this page · raw message

Signature · 1 line
-ck