linux-rt-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: John Kacur <jkacur@redhat.com>
To: Clark Williams <williams@redhat.com>
Cc: rt-users <linux-rt-users@vger.kernel.org>,
	Carsten Emde <C.Emde@osadl.org>, John Kacur <jkacur@redhat.com>
Subject: [PATCH] cyclictest: Use symbolic names for scheduling policy
Date: Mon,  8 Mar 2010 02:18:22 +0100	[thread overview]
Message-ID: <1268011104-22451-3-git-send-email-jkacur@redhat.com> (raw)
In-Reply-To: <1268011104-22451-1-git-send-email-jkacur@redhat.com>

- Use symbolic names for scheduling policies, that is, don't assume
	SCHED_RR is 2, use SCHED_RR instead, and so on.

- Fix the logic in handlepolicy(char *polname)
	- remove the test with the unreachable line,
	- make the default SCHED_FIFO if we don't recognize the
	requested policy.

Signed-off-by: John Kacur <jkacur@redhat.com>
---
 src/cyclictest/cyclictest.c |   15 +++++----------
 1 files changed, 5 insertions(+), 10 deletions(-)

diff --git a/src/cyclictest/cyclictest.c b/src/cyclictest/cyclictest.c
index d38c0a7..066ca79 100644
--- a/src/cyclictest/cyclictest.c
+++ b/src/cyclictest/cyclictest.c
@@ -826,13 +826,8 @@ static void handlepolicy(char *polname)
 		policy = SCHED_FIFO;
 	else if (strncasecmp(polname, "rr", 2) == 0)
 		policy = SCHED_RR;
-
-	if (policy == SCHED_FIFO || policy == SCHED_RR) {
-		if (policy == 0)
-			policy = 1;
-	}
-	else 
-		policy = 0;
+	else	/* default policy if we don't recognize the request */
+		policy = SCHED_FIFO;
 }
 
 static char *policyname(int policy)
@@ -1303,9 +1298,9 @@ int main(int argc, char **argv)
 		par->prio = priority;
 		if (priority && !histogram && !smp && !numa)
 			priority--;
-                if      (priority && policy <= 1) par->policy = SCHED_FIFO;
-                else if (priority && policy == 2) par->policy = SCHED_RR;
-                else                              par->policy = SCHED_OTHER;
+                if (priority && policy == SCHED_FIFO) par->policy = SCHED_FIFO;
+                else if (priority && policy == SCHED_RR) par->policy = SCHED_RR;
+                else  par->policy = SCHED_OTHER;
 		par->clock = clocksources[clocksel];
 		par->mode = mode;
 		par->timermode = timermode;
-- 
1.6.0.6


  parent reply	other threads:[~2010-03-08  1:18 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-08  1:18 [PATCH] Fix scheduling policy problems for cyclictest John Kacur
2010-03-08  1:18 ` [PATCH] Revert "simplify equal priority logic for cyclictest" John Kacur
2010-03-08  8:01   ` Carsten Emde
2010-03-08  1:18 ` John Kacur [this message]
2010-03-08  8:35   ` [PATCH] cyclictest: Use symbolic names for scheduling policy Carsten Emde
2010-03-08 12:48     ` John Kacur
2010-03-08 13:01       ` Carsten Emde
2010-03-08 13:11         ` John Kacur
2010-03-08  1:18 ` [PATCH] cyclictest: Fix spelling mistake in the man page John Kacur
2010-03-08  1:18 ` [PATCH] cyclictest: Make the default scheduling policy SCHED_FIFO John Kacur

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=1268011104-22451-3-git-send-email-jkacur@redhat.com \
    --to=jkacur@redhat.com \
    --cc=C.Emde@osadl.org \
    --cc=linux-rt-users@vger.kernel.org \
    --cc=williams@redhat.com \
    /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;
as well as URLs for NNTP newsgroup(s).