All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Jeehong Kim <jhez.kim@samsung.com>
Cc: mingo@redhat.com, linux-kernel@vger.kernel.org,
	kernel-janitors@vger.kernel.org, ezjjilong@gmail.com,
	Ben Segall <bsegall@google.com>
Subject: Re: [PATCH V2] sched/fair: Fix that tasks are not constrained by cfs_b->quota on hotplug core, when
Date: Thu, 01 Sep 2016 11:01:32 +0000	[thread overview]
Message-ID: <20160901110132.GG10138@twins.programming.kicks-ass.net> (raw)
In-Reply-To: <1472562760-20842-1-git-send-email-jhez.kim@samsung.com>


You forgot to Cc Ben, who gave you feedback on v1, which is rather poor
style. Also, I don't see how kernel-janitors is relevant to this patch.
This is very much not a janitorial thing.

(also, why send it twice?)

On Tue, Aug 30, 2016 at 10:12:40PM +0900, Jeehong Kim wrote:
> In case that CONFIG_HOTPLUG_CPU and CONFIG_CFS_BANDWIDTH is turned on
> and tasks in bandwidth controlled task group run on hotplug core,
> the tasks are not controlled by cfs_b->quota when hotplug core is offline
> and then online. The remaining tasks in task group consume all of
> cfs_b->quota on other cores.
> 
> The cause of this problem is described as below:
> 
> 1. When hotplug core is offline while tasks in task group run
> on hotplug core, unregister_fair_sched_group() deletes
> leaf_cfs_rq_list of tg->cfs_rq[cpu] from &rq_of(cfs_rq)->leaf_cfs_rq_list.
> 
> 2. Then, when hotplug core is online, update_runtime_enabled()
> registers cfs_b->quota on cfs_rq->runtime_enabled of all leaf cfs_rq
> on runqueue. However, because this is before enqueue_entity() adds
> &cfs_rq->leaf_cfs_rq_list on &rq_of(cfs_rq)->leaf_cfs_rq_list,
> cfs->quota is not register on cfs_rq->runtime_enabled.
> 
> To resolve this problem, this patch makes update_runtime_enabled()
> registers cfs_b->quota by using walk_tg_tree_from().


> +static int __maybe_unused __update_runtime_enabled(struct task_group *tg, void *data)
>  {
> +	struct rq *rq = data;
> +	struct cfs_rq *cfs_rq = tg->cfs_rq[cpu_of(rq)];
> +	struct cfs_bandwidth *cfs_b = &cfs_rq->tg->cfs_bandwidth;
> 
> +	raw_spin_lock(&cfs_b->lock);
> +	cfs_rq->runtime_enabled = cfs_b->quota != RUNTIME_INF;
> +	raw_spin_unlock(&cfs_b->lock);
> 
> +	return 0;
> +}
> +
> +static void __maybe_unused update_runtime_enabled(struct rq *rq)
> +{
> +	struct cfs_rq *cfs_rq = &rq->cfs;
> +
> +	/* register cfs_b->quota on the whole tg tree */
> +	rcu_read_lock();
> +	walk_tg_tree_from(cfs_rq->tg, __update_runtime_enabled, tg_nop, (void *)rq);
> +	rcu_read_unlock();
>  }

Looks ok, performance on hotplug doesn't really matter. Ben, you happy
with this?

WARNING: multiple messages have this Message-ID (diff)
From: Peter Zijlstra <peterz@infradead.org>
To: Jeehong Kim <jhez.kim@samsung.com>
Cc: mingo@redhat.com, linux-kernel@vger.kernel.org,
	kernel-janitors@vger.kernel.org, ezjjilong@gmail.com,
	Ben Segall <bsegall@google.com>
Subject: Re: [PATCH V2] sched/fair: Fix that tasks are not constrained by cfs_b->quota on hotplug core, when hotplug core is offline and then online.
Date: Thu, 1 Sep 2016 13:01:32 +0200	[thread overview]
Message-ID: <20160901110132.GG10138@twins.programming.kicks-ass.net> (raw)
In-Reply-To: <1472562760-20842-1-git-send-email-jhez.kim@samsung.com>


You forgot to Cc Ben, who gave you feedback on v1, which is rather poor
style. Also, I don't see how kernel-janitors is relevant to this patch.
This is very much not a janitorial thing.

(also, why send it twice?)

On Tue, Aug 30, 2016 at 10:12:40PM +0900, Jeehong Kim wrote:
> In case that CONFIG_HOTPLUG_CPU and CONFIG_CFS_BANDWIDTH is turned on
> and tasks in bandwidth controlled task group run on hotplug core,
> the tasks are not controlled by cfs_b->quota when hotplug core is offline
> and then online. The remaining tasks in task group consume all of
> cfs_b->quota on other cores.
> 
> The cause of this problem is described as below:
> 
> 1. When hotplug core is offline while tasks in task group run
> on hotplug core, unregister_fair_sched_group() deletes
> leaf_cfs_rq_list of tg->cfs_rq[cpu] from &rq_of(cfs_rq)->leaf_cfs_rq_list.
> 
> 2. Then, when hotplug core is online, update_runtime_enabled()
> registers cfs_b->quota on cfs_rq->runtime_enabled of all leaf cfs_rq
> on runqueue. However, because this is before enqueue_entity() adds
> &cfs_rq->leaf_cfs_rq_list on &rq_of(cfs_rq)->leaf_cfs_rq_list,
> cfs->quota is not register on cfs_rq->runtime_enabled.
> 
> To resolve this problem, this patch makes update_runtime_enabled()
> registers cfs_b->quota by using walk_tg_tree_from().


> +static int __maybe_unused __update_runtime_enabled(struct task_group *tg, void *data)
>  {
> +	struct rq *rq = data;
> +	struct cfs_rq *cfs_rq = tg->cfs_rq[cpu_of(rq)];
> +	struct cfs_bandwidth *cfs_b = &cfs_rq->tg->cfs_bandwidth;
> 
> +	raw_spin_lock(&cfs_b->lock);
> +	cfs_rq->runtime_enabled = cfs_b->quota != RUNTIME_INF;
> +	raw_spin_unlock(&cfs_b->lock);
> 
> +	return 0;
> +}
> +
> +static void __maybe_unused update_runtime_enabled(struct rq *rq)
> +{
> +	struct cfs_rq *cfs_rq = &rq->cfs;
> +
> +	/* register cfs_b->quota on the whole tg tree */
> +	rcu_read_lock();
> +	walk_tg_tree_from(cfs_rq->tg, __update_runtime_enabled, tg_nop, (void *)rq);
> +	rcu_read_unlock();
>  }

Looks ok, performance on hotplug doesn't really matter. Ben, you happy
with this?

  reply	other threads:[~2016-09-01 11:01 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-30 13:09 [PATCH V2] sched/fair: Fix that tasks are not constrained by cfs_b->quota on hotplug core, when hotp Jeehong Kim
2016-08-30 13:09 ` [PATCH V2] sched/fair: Fix that tasks are not constrained by cfs_b->quota on hotplug core, when hotplug core is offline and then online Jeehong Kim
2016-08-30 13:12 ` [PATCH V2] sched/fair: Fix that tasks are not constrained by cfs_b->quota on hotplug core, when hotp Jeehong Kim
2016-08-30 13:12   ` [PATCH V2] sched/fair: Fix that tasks are not constrained by cfs_b->quota on hotplug core, when hotplug core is offline and then online Jeehong Kim
2016-09-01 11:01   ` Peter Zijlstra [this message]
2016-09-01 11:01     ` Peter Zijlstra
2016-09-01 11:52     ` [PATCH V2] sched/fair: Fix that tasks are not constrained by cfs_b->quota on hotplug core, when Jeehong Kim
2016-09-01 11:52       ` [PATCH V2] sched/fair: Fix that tasks are not constrained by cfs_b->quota on hotplug core, when hotplug core is offline and then online Jeehong Kim
2016-09-01 17:23     ` [PATCH V2] sched/fair: Fix that tasks are not constrained by cfs_b->quota on hotplug core, when bsegall
2016-09-01 17:23       ` [PATCH V2] sched/fair: Fix that tasks are not constrained by cfs_b->quota on hotplug core, when hotplug core is offline and then online bsegall

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=20160901110132.GG10138@twins.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=bsegall@google.com \
    --cc=ezjjilong@gmail.com \
    --cc=jhez.kim@samsung.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.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 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.