From: Mike Galbraith <efault@gmx.de>
To: Dima Zavin <dmitriyz@google.com>
Cc: "Peter Zijlstra" <peterz@infradead.org>,
"Ingo Molnar" <mingo@elte.hu>, "Arve Hjønnevåg" <arve@google.com>,
LKML <linux-kernel@vger.kernel.org>
Subject: Re: broken behavior in cfs when moving threads between cgroups
Date: Tue, 28 Sep 2010 10:17:58 +0200 [thread overview]
Message-ID: <1285661878.2795.70.camel@marge.simson.net> (raw)
In-Reply-To: <AANLkTinmQOYQAOPkQsZNhJBJtCss3ZtHN_a6h4fpamtz@mail.gmail.com>
On Mon, 2010-09-27 at 23:07 -0700, Dima Zavin wrote:
> I'm not really sure how to fix #1 cleanly, since we don't have enough
> information (i.e. we don't know the previous group) inside
> moved_group_fair() to adjust the value. It has to be adjusted in
> sched_move_task(), but I don't see the right interface to do that. I
> included a hacky patch further down that accesses the sched_fair internals
> directly, which I know is wrong but illustrates what I think needs to be done.
I don't really see the relevance of an entity's lag in it's previous
group, so would tend toward entry at parity.
Maybe the move _should_ be treated as a fork, for the same reason we do
START_DEBIT, but if so, seems to me it's irrelevant whether the task is
currently sleeping or not, it's going to run for the first time in it's
new home just as any runnable task, and may do so very soon. OTOH,
frequent moves with that hefty START_DEBIT price tag could hurt very
badly, and makes caring about previous lag seem pointless.
-Mike
(untested)
diff --git a/kernel/sched_fair.c b/kernel/sched_fair.c
index 9b5b4f8..4dc6b2f 100644
--- a/kernel/sched_fair.c
+++ b/kernel/sched_fair.c
@@ -3827,10 +3827,14 @@ static void set_curr_task_fair(struct rq *rq)
static void moved_group_fair(struct task_struct *p, int on_rq)
{
struct cfs_rq *cfs_rq = task_cfs_rq(p);
+ struct sched_entity *se = &p->se;
+ u64 vruntime = 0;
update_curr(cfs_rq);
if (!on_rq)
- place_entity(cfs_rq, &p->se, 1);
+ vruntime = cfs_rq->min_vruntime;
+
+ se->vruntime = vruntime;
}
#endif
next prev parent reply other threads:[~2010-09-28 8:17 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-09-28 6:07 broken behavior in cfs when moving threads between cgroups Dima Zavin
2010-09-28 8:17 ` Mike Galbraith [this message]
2010-09-28 22:57 ` Dima Zavin
2010-09-28 23:23 ` Dima Zavin
2010-09-29 2:53 ` Mike Galbraith
2010-09-29 6:42 ` Mike Galbraith
2010-09-29 6:45 ` Dima Zavin
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=1285661878.2795.70.camel@marge.simson.net \
--to=efault@gmx.de \
--cc=arve@google.com \
--cc=dmitriyz@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=peterz@infradead.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.