Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1415074

Re: [PATCH v4 3/5] sched/fair: Skip detach sched avgs for new task when changing task groups

Path csiph.com!feeder.erje.net!1.eu.feeder.erje.net!news.unit0.net!news.panservice.it!bofh.it!news.nic.it!robomod
From Matt Fleming <matt@codeblueprint.co.uk>
Newsgroups linux.kernel
Subject Re: [PATCH v4 3/5] sched/fair: Skip detach sched avgs for new task when changing task groups
Date Mon, 06 Jun 2016 16:10:03 +0200
Message-ID <rH3o7-5Yv-69@gated-at.bofh.it> (permalink)
References <rGXVo-2jv-5@gated-at.bofh.it> <rGXVo-2jv-3@gated-at.bofh.it>
X-Original-To Yuyang Du <yuyang.du@intel.com>
Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=codeblueprint-co-uk.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=tFQKSsTj848iinMZZFhRTrYauMfD8BV/F4QSML2EkP0=; b=1FmWibauJX5AO7qJ7YAgBy5Qktwv7Bm6yMAI6Kqy1A7P1hJLm4Sbu+nCCHi+6ReaCG YqF3DjJCAF1ja1vZhvSHakkovaN8l7b6LcwwbEnR+PFXJU1cO+bOmadoZ+Rjx2Hr2PUR oKFgRznHGMG2d8JW1ph5BmtFd1ra0cyWLRxsJxD3vLpbZFSBMUeeZyUB5EPPrhSo5zkn UWExYQYmxUnBBgpkYhVUXVWNqzfwhVUnk3PUxSwewwLRMzBwLP87AMWMpq3swFrOkZPu bJnOaZ54rZXkuUwf3ElhJe+s48OL9Mnf85+mEVxWV1zEg14p7PwNVday9QegCIR+z3SZ Z8Wg==
X-Google-Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=tFQKSsTj848iinMZZFhRTrYauMfD8BV/F4QSML2EkP0=; b=bpsIKgwr7oQuEOAzQLgjCJ/gAnw7wEKVbW1T7vuJNTteCFx8pHH6R+t80tfUWLjhLL SCopIa0JJ3C/F4LceCTn8VyFPVzUQpoSUYXyYU3gVR6lGqTCVg3rVybxNe6zZrbCIObV 6LZQgWVdFffiC/oX64+V4BFsGTTOPUB4IC6rFKcjND+prm+N4W1m2j9QzczKnrli72Nk fd1snu6m0L9E31Iq1lvydK08DMJbximJ4OTu9ZWt6sjpDPgF8K8RZcsrKIkT8MCqD3uW 2xk7RLhp1gkc4z2I5+yQ+Mfb7iMBKVhLnRWITwFopaOP5NLg5VtmggKiixNJDnl9WgxK oTNw==
X-Gm-Message-State ALyK8tK6xq5q0n5HJHXuXed9p+a3BaszfMQ+u7JYWQavjUoWf1UVtORp++/Vp3o4ycFi3w==
X-Received by 10.194.203.135 with SMTP id kq7mr16053713wjc.46.1465221820212; Mon, 06 Jun 2016 07:03:40 -0700 (PDT)
MIME-Version 1.0
Content-Type text/plain; charset=us-ascii
Content-Disposition inline
User-Agent Mutt/1.5.24+41 (02bc14ed1569) (2015-08-30)
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 48
Organization linux.* mail to news gateway
X-Original-Cc peterz@infradead.org, mingo@kernel.org, linux-kernel@vger.kernel.org, bsegall@google.com, pjt@google.com, morten.rasmussen@arm.com, vincent.guittot@linaro.org, dietmar.eggemann@arm.com
X-Original-Date Mon, 6 Jun 2016 15:03:38 +0100
X-Original-Message-ID <20160606140338.GS2658@codeblueprint.co.uk>
X-Original-References <1465172441-27727-1-git-send-email-yuyang.du@intel.com> <1465172441-27727-4-git-send-email-yuyang.du@intel.com>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1415074

Show key headers only | View raw


On Mon, 06 Jun, at 08:20:39AM, Yuyang Du wrote:
> Newly forked task has not been enqueued, so should not be removed from
> cfs_rq in task_move_group_fair(). To do so, we need to pass the fork
> information all the way from sched_move_task() to task_move_group_fair().
> 
> Signed-off-by: Yuyang Du <yuyang.du@intel.com>
> ---
>  kernel/sched/auto_group.c |    2 +-
>  kernel/sched/core.c       |    8 ++++----
>  kernel/sched/fair.c       |    8 ++++++--
>  kernel/sched/sched.h      |    4 ++--
>  4 files changed, 13 insertions(+), 9 deletions(-)

[...]

> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> index 28b3415..370e284 100644
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -8429,9 +8429,13 @@ void init_cfs_rq(struct cfs_rq *cfs_rq)
>  }
>  
>  #ifdef CONFIG_FAIR_GROUP_SCHED
> -static void task_move_group_fair(struct task_struct *p)
> +static void task_move_group_fair(struct task_struct *p, bool fork)
>  {
> -	detach_task_cfs_rq(p);
> +	/*
> +	 * Newly forked task should not be removed from any cfs_rq
> +	 */
> +	if (!fork)
> +		detach_task_cfs_rq(p);
>  	set_task_rq(p, task_cpu(p));
>  	attach_task_cfs_rq(p);
>  	/*

Wouldn't it be more symmetric to add,

	if (p->se.avg.last_update_time)
		__update_load_avg(...)

to detach_entity_load_avg() so that there's no need to pass the @fork
parameter all the way down the stack, and more importantly, remember
to *not* call detach_task_cfs_rq() if the code changes in the future?

Additionally adding the above check looks like it would fix a race
that (I think) occurs if a newly forked task's class is changed before
it is enqueued in wake_up_new_task().

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v4 3/5] sched/fair: Skip detach sched avgs for new task when changing task groups Yuyang Du <yuyang.du@intel.com> - 2016-06-06 10:20 +0200
  Re: [PATCH v4 3/5] sched/fair: Skip detach sched avgs for new task  when changing task groups Peter Zijlstra <peterz@infradead.org> - 2016-06-06 12:00 +0200
  Re: [PATCH v4 3/5] sched/fair: Skip detach sched avgs for new task  when changing task groups Matt Fleming <matt@codeblueprint.co.uk> - 2016-06-06 16:10 +0200
    Re: [PATCH v4 3/5] sched/fair: Skip detach sched avgs for new task  when changing task groups Yuyang Du <yuyang.du@intel.com> - 2016-06-07 05:20 +0200

csiph-web