mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Chen, Kenneth W" <kenneth.w.chen@intel.com>
To: <nickpiggin@yahoo.com.au>, "Ingo Molnar" <mingo@elte.hu>,
	"Siddha, Suresh B" <suresh.b.siddha@intel.com>
Cc: <linux-kernel@vger.kernel.org>
Subject: [patch] sched: optimize activate_task for RT task
Date: Tue, 14 Nov 2006 15:41:54 -0800	[thread overview]
Message-ID: <000301c70846$786c87e0$d834030a@amr.corp.intel.com> (raw)

RT task does not participate in interactiveness priority and thus
shouldn't be bothered with timestamp when task is being put on run
queue. We should push all of the time calculation inside already
existed if (!rt_task) block.


Signed-off-by: Ken Chen <kenneth.w.chen@intel.com>

--- ./kernel/sched.c.orig	2006-11-14 13:29:37.000000000 -0800
+++ ./kernel/sched.c	2006-11-14 13:52:02.000000000 -0800
@@ -936,20 +936,19 @@ static int recalc_task_prio(struct task_
  */
 static void activate_task(struct task_struct *p, struct rq *rq, int local)
 {
-	unsigned long long now;
-
-	now = sched_clock();
+	if (!rt_task(p)) {
+		unsigned long long now = sched_clock();
 #ifdef CONFIG_SMP
-	if (!local) {
-		/* Compensate for drifting sched_clock */
-		struct rq *this_rq = this_rq();
-		now = (now - this_rq->timestamp_last_tick)
-			+ rq->timestamp_last_tick;
-	}
+		if (!local) {
+			/* Compensate for drifting sched_clock */
+			struct rq *this_rq = this_rq();
+			now = (now - this_rq->timestamp_last_tick)
+				+ rq->timestamp_last_tick;
+		}
 #endif
-
-	if (!rt_task(p))
 		p->prio = recalc_task_prio(p, now);
+		p->timestamp = now;
+	}
 
 	/*
 	 * This checks to make sure it's not an uninterruptible task
@@ -973,7 +972,6 @@ static void activate_task(struct task_st
 			p->sleep_type = SLEEP_INTERACTIVE;
 		}
 	}
-	p->timestamp = now;
 
 	__activate_task(p, rq);
 }

                 reply	other threads:[~2006-11-14 23:41 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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='000301c70846$786c87e0$d834030a@amr.corp.intel.com' \
    --to=kenneth.w.chen@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=nickpiggin@yahoo.com.au \
    --cc=suresh.b.siddha@intel.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

Powered by JetHome