public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Robert Love <rml@tech9.net>
To: alan@lxorguk.ukuu.org.uk
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] 2.4-ac: more scheduler updates (2/3)
Date: 20 May 2002 14:16:22 -0700	[thread overview]
Message-ID: <1021929382.9901.4.camel@sinai> (raw)
In-Reply-To: <1021928919.925.314.camel@sinai>

[-- Attachment #1: Type: text/plain, Size: 598 bytes --]

Alan,

This patch further cleans up the notion of maximum priority / maximum RT
priority and sets the stage for the user to set any value they choose. 
This patch does _not_ export any configure settings and it results in
the same object code as before.

If you did not like the previous version of this (which created
configure settings) then hopefully this version should be acceptable. 
It is in 2.5 now.

This depends on the first patch (chunk #1) since we move
sched_find_first_set around.  Otherwise the changes are orthogonal.

Patch is against 2.4.19-pre8-ac5, please apply.

	Robert Love


[-- Attachment #2: sched-maxrtprio-rml-2.4.19-pre8-ac5-1.patch --]
[-- Type: text/x-patch, Size: 3331 bytes --]

diff -urN linux-2.4.19-pre8-ac5-rml/include/asm-i386/bitops.h linux/include/asm-i386/bitops.h
--- linux-2.4.19-pre8-ac5-rml/include/asm-i386/bitops.h	Mon May 20 14:07:09 2002
+++ linux/include/asm-i386/bitops.h	Mon May 20 14:08:56 2002
@@ -428,7 +428,7 @@
  * unlikely to be set. It's guaranteed that at least one of the 140
  * bits is cleared.
  */
-static inline int sched_find_first_bit(unsigned long *b)
+static inline int _sched_find_first_bit(unsigned long *b)
 {
 	if (unlikely(b[0]))
 		return __ffs(b[0]);
diff -urN linux-2.4.19-pre8-ac5-rml/include/linux/sched.h linux/include/linux/sched.h
--- linux-2.4.19-pre8-ac5-rml/include/linux/sched.h	Mon May 20 14:07:07 2002
+++ linux/include/linux/sched.h	Mon May 20 14:10:19 2002
@@ -162,6 +162,36 @@
 extern int current_is_keventd(void);
 
 /*
+ * Priority of a process goes from 0..MAX_PRIO-1, valid RT
+ * priority is 0..MAX_RT_PRIO-1, and SCHED_OTHER tasks are
+ * in the range MAX_RT_PRIO..MAX_PRIO-1. Priority values
+ * are inverted: lower p->prio value means higher priority.
+ *
+ * The MAX_RT_USER_PRIO value allows the actual maximum
+ * RT priority to be separate from the value exported to
+ * user-space.  This allows kernel threads to set their
+ * priority to a value higher than any user task. Note:
+ * MAX_RT_PRIO must not be smaller than MAX_USER_RT_PRIO.
+ */
+
+#define MAX_USER_RT_PRIO	100
+#define MAX_RT_PRIO		MAX_USER_RT_PRIO
+
+#define MAX_PRIO		(MAX_RT_PRIO + 40)
+
+/*
+ * The maximum RT priority is configurable.  If the resulting
+ * bitmap is 160-bits , we can use a hand-coded routine which
+ * is optimal.  Otherwise, we fall back on a generic routine for
+ * finding the first set bit from an arbitrarily-sized bitmap.
+ */
+#if MAX_PRIO < 160 && MAX_PRIO > 127
+#define sched_find_first_bit(map)	_sched_find_first_bit(map)
+#else
+#define sched_find_first_bit(map)	find_first_bit(map, MAX_PRIO)
+#endif
+
+/*
  * The default fd array needs to be at least BITS_PER_LONG,
  * as this is the granularity returned by copy_fdset().
  */
@@ -478,8 +508,8 @@
     addr_limit:		KERNEL_DS,					\
     exec_domain:	&default_exec_domain,				\
     lock_depth:		-1,						\
-    prio:		120,						\
-    static_prio:	120,						\
+    prio:		MAX_PRIO-20,					\
+    static_prio:	MAX_PRIO-20,					\
     policy:		SCHED_OTHER,					\
     cpus_allowed:	-1,						\
     mm:			NULL,						\
diff -urN linux-2.4.19-pre8-ac5-rml/kernel/sched.c linux/kernel/sched.c
--- linux-2.4.19-pre8-ac5-rml/kernel/sched.c	Mon May 20 14:07:07 2002
+++ linux/kernel/sched.c	Mon May 20 14:08:47 2002
@@ -26,20 +26,6 @@
 #include <linux/kernel_stat.h>
 
 /*
- * Priority of a process goes from 0 to 139. The 0-99
- * priority range is allocated to RT tasks, the 100-139
- * range is for SCHED_OTHER tasks. Priority values are
- * inverted: lower p->prio value means higher priority.
- * 
- * MAX_USER_RT_PRIO allows the actual maximum RT priority
- * to be separate from the value exported to user-space.
- * NOTE: MAX_RT_PRIO must not be smaller than MAX_USER_RT_PRIO.
- */
-#define MAX_RT_PRIO		100
-#define MAX_USER_RT_PRIO	100
-#define MAX_PRIO		(MAX_RT_PRIO + 40)
-
-/*
  * Convert user-nice values [ -20 ... 0 ... 19 ]
  * to static priority [ MAX_RT_PRIO..MAX_PRIO-1 ],
  * and back.

  reply	other threads:[~2002-05-20 21:16 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-05-20 21:08 [PATCH] 2.4-ac: more scheduler updates (1/3) Robert Love
2002-05-20 21:16 ` Robert Love [this message]
2002-05-20 21:22   ` [PATCH] 2.4-ac: more scheduler updates (3/3) Robert Love
2002-05-20 22:58 ` [PATCH] 2.4-ac: more scheduler updates (1/3) J.A. Magallon
2002-05-20 23:03   ` Robert Love

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=1021929382.9901.4.camel@sinai \
    --to=rml@tech9.net \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=linux-kernel@vger.kernel.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