mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Charles Wang <muming.wq@gmail.com>
To: mingo@kernel.org, gaoyang.zyh@taobao.com
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] sched: Precise load checking in get_rr_interval_fair
Date: Thu, 28 Mar 2013 21:37:45 +0800	[thread overview]
Message-ID: <1364477865-1777-1-git-send-email-muming.wq@gmail.com> (raw)

From: Charles Wang <muming.wq@taobao.com>

Positive load weight of rq.cfs can not represent positive load weight
of se->cfs_rq. And when se->cfs_rq's load is 0, the slice calculated 
by sched_slice is not that sensible.

Use se->cfs_rq for load checking instead of rq->cfs. And correct the
comments.

Cc: Ingo Molnar <mingo@elte.hu>
Cc: Zhu Yanhai <gaoyang.zyh@taobao.com>
Signed-off-by: Charles Wang <muming.wq@taobao.com>

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 539760e..5d58ac9 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -6086,14 +6086,15 @@ void unregister_fair_sched_group(struct task_group *tg, int cpu) { }
 static unsigned int get_rr_interval_fair(struct rq *rq, struct task_struct *task)
 {
 	struct sched_entity *se = &task->se;
+	struct cfs_rq *cfs_rq = cfs_rq_of(se);
 	unsigned int rr_interval = 0;
 
 	/*
 	 * Time slice is 0 for SCHED_OTHER tasks that are on an otherwise
-	 * idle runqueue:
+	 * idle cfs_rq:
 	 */
-	if (rq->cfs.load.weight)
-		rr_interval = NS_TO_JIFFIES(sched_slice(cfs_rq_of(se), se));
+	if (cfs_rq->load.weight)
+		rr_interval = NS_TO_JIFFIES(sched_slice(cfs_rq, se));
 
 	return rr_interval;
 }
-- 
1.7.9.5


                 reply	other threads:[~2013-03-28 13:38 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=1364477865-1777-1-git-send-email-muming.wq@gmail.com \
    --to=muming.wq@gmail.com \
    --cc=gaoyang.zyh@taobao.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@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

all inboxes | Powered by JetHome®