Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1221520 > unrolled thread
| Started by | Peter Zijlstra <peterz@infradead.org> |
|---|---|
| First post | 2015-09-09 17:20 +0200 |
| Last post | 2015-09-10 11:10 +0200 |
| Articles | 2 — 2 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: [PATCH 1/4] sched/{cpuset,core}: restore complete root_domain status across hotplug Peter Zijlstra <peterz@infradead.org> - 2015-09-09 17:20 +0200
Re: [PATCH 1/4] sched/{cpuset,core}: restore complete root_domain status across hotplug Juri Lelli <juri.lelli@arm.com> - 2015-09-10 11:10 +0200
| From | Peter Zijlstra <peterz@infradead.org> |
|---|---|
| Date | 2015-09-09 17:20 +0200 |
| Subject | Re: [PATCH 1/4] sched/{cpuset,core}: restore complete root_domain status across hotplug |
| Message-ID | <q6Pkd-6PL-1@gated-at.bofh.it> |
On Wed, Sep 02, 2015 at 11:01:33AM +0100, Juri Lelli wrote:
> Hotplug operations are destructive w.r.t data associated with cpuset;
> in this case we care about root_domains. SCHED_DEADLINE puts bandwidth
> information regarding admitted tasks on root_domains, information that
> is gone when an hotplug operation happens. Also, it is not currently
> possible to tell to which task(s) the allocated bandwidth belongs, as
> this link is lost after sched_setscheduler() succeeds.
>
> This patch forces rebuilding of allocated bandwidth information at
> root_domain level after cpuset_hotplug_workfn() callback is done
> setting up scheduling and root domains.
> +static void cpuset_hotplug_update_rd(void)
> +{
> + struct cpuset *cs;
> + struct cgroup_subsys_state *pos_css;
> +
> + mutex_lock(&cpuset_mutex);
> + rcu_read_lock();
> + cpuset_for_each_descendant_pre(cs, pos_css, &top_cpuset) {
> + if (!css_tryget_online(&cs->css))
> + continue;
> + rcu_read_unlock();
> +
> + update_tasks_rd(cs);
> +
> + rcu_read_lock();
> + css_put(&cs->css);
> + }
> + rcu_read_unlock();
> + mutex_unlock(&cpuset_mutex);
> +}
> +
> +/**
> * cpuset_hotplug_workfn - handle CPU/memory hotunplug for a cpuset
> *
> * This function is called after either CPU or memory configuration has
> @@ -2296,6 +2335,8 @@ static void cpuset_hotplug_workfn(struct work_struct *work)
> /* rebuild sched domains if cpus_allowed has changed */
> if (cpus_updated)
> rebuild_sched_domains();
> +
> + cpuset_hotplug_update_rd();
> }
So the problem is that rebuild_sched_domains() destroys rd->dl_bw ? I
worry the above is racy in that you do not restore under the same
cpuset_mutex instance as you rebuild.
That is, what will stop a new task from joining the cpuset and
overloading the bandwidth between the root-domain getting rebuild and
restoring the bandwidth?
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [next] | [standalone]
| From | Juri Lelli <juri.lelli@arm.com> |
|---|---|
| Date | 2015-09-10 11:10 +0200 |
| Message-ID | <q761I-5mS-3@gated-at.bofh.it> |
| In reply to | #1221520 |
Hi Peter,
On 09/09/15 16:11, Peter Zijlstra wrote:
> On Wed, Sep 02, 2015 at 11:01:33AM +0100, Juri Lelli wrote:
>> Hotplug operations are destructive w.r.t data associated with cpuset;
>> in this case we care about root_domains. SCHED_DEADLINE puts bandwidth
>> information regarding admitted tasks on root_domains, information that
>> is gone when an hotplug operation happens. Also, it is not currently
>> possible to tell to which task(s) the allocated bandwidth belongs, as
>> this link is lost after sched_setscheduler() succeeds.
>>
>> This patch forces rebuilding of allocated bandwidth information at
>> root_domain level after cpuset_hotplug_workfn() callback is done
>> setting up scheduling and root domains.
>
>> +static void cpuset_hotplug_update_rd(void)
>> +{
>> + struct cpuset *cs;
>> + struct cgroup_subsys_state *pos_css;
>> +
>> + mutex_lock(&cpuset_mutex);
>> + rcu_read_lock();
>> + cpuset_for_each_descendant_pre(cs, pos_css, &top_cpuset) {
>> + if (!css_tryget_online(&cs->css))
>> + continue;
>> + rcu_read_unlock();
>> +
>> + update_tasks_rd(cs);
>> +
>> + rcu_read_lock();
>> + css_put(&cs->css);
>> + }
>> + rcu_read_unlock();
>> + mutex_unlock(&cpuset_mutex);
>> +}
>> +
>> +/**
>> * cpuset_hotplug_workfn - handle CPU/memory hotunplug for a cpuset
>> *
>> * This function is called after either CPU or memory configuration has
>> @@ -2296,6 +2335,8 @@ static void cpuset_hotplug_workfn(struct work_struct *work)
>> /* rebuild sched domains if cpus_allowed has changed */
>> if (cpus_updated)
>> rebuild_sched_domains();
>> +
>> + cpuset_hotplug_update_rd();
>> }
>
> So the problem is that rebuild_sched_domains() destroys rd->dl_bw ? I
> worry the above is racy in that you do not restore under the same
> cpuset_mutex instance as you rebuild.
>
Yes, problem is that root_domain is gone after rebuild_sched_domains().
We store admitted bandwidth information there, so we loose it during
hotplug. Problem also is that only other information about which task
has been admitted, in which cpuset, resides in cpusets themselves.
> That is, what will stop a new task from joining the cpuset and
> overloading the bandwidth between the root-domain getting rebuild and
> restoring the bandwidth?
>
Right, this is broken. At first, I tried to fix this somewhere in
rebuild_sched_domains_locked() (for example via rq_{on,off}line_dl),
but I failed since, as I say above, we don't have required information
on rqs. I sort of remember I came up with a working-ish solution
saving bw in partition_sched_domains() across destroy and build, but
that was uglier that this patch :-/.
I'll keep thinking, just wanted to keep the problem known and share
what I have (not much indeed).
Thanks,
- Juri
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web