public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Nikanth Karthikesan <knikanth@suse.de>
To: mingo@elte.hu
Cc: dmitry.adamushko@gmail.com, a.p.zijlstra@chello.nl,
	linux-kernel@vger.kernel.org, vatsa@linux.vnet.ibm.com
Subject: [PATCH] sched: minor optimization
Date: Sat, 24 Nov 2007 17:16:53 +0530	[thread overview]
Message-ID: <47480F2D.3030408@suse.de> (raw)

As an optimization, if all tasks are in the fair class, the next task is
directly picked from fair_sched_class. But, if it returns no task we go
through again from sched_class_highest which could be avoided and
instead return the idle task directly.


Signed-off-by : Nikanth Karthikesan <knikanth@suse.de>
---
 kernel/sched.c |    2 ++
 1 file changed, 2 insertions(+)

Index: b/kernel/sched.c
===================================================================
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -3449,6 +3449,8 @@ pick_next_task(struct rq *rq, struct tas
 		p = fair_sched_class.pick_next_task(rq);
 		if (likely(p))
 			return p;
+		else /* rq->nr_running is zero */
+			return idle_sched_class.pick_next_task(rq);
 	}

 	class = sched_class_highest;

             reply	other threads:[~2007-11-23 11:45 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-24 11:46 Nikanth Karthikesan [this message]
2007-11-23 12:18 ` [PATCH] sched: minor optimization Dmitry Adamushko
  -- strict thread matches above, loose matches on Subject: below --
2007-11-24 13:26 Nikanth Karthikesan

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=47480F2D.3030408@suse.de \
    --to=knikanth@suse.de \
    --cc=a.p.zijlstra@chello.nl \
    --cc=dmitry.adamushko@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=vatsa@linux.vnet.ibm.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