aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Zijlstra <peterz@infradead.org>2016-05-09 04:37:57 -0400
committerIngo Molnar <mingo@kernel.org>2016-09-30 04:54:06 -0400
commit16f3ef46805a5ffc75549deac2ff6af08bdf590b (patch)
tree08ae64c54ddf97ea5b960d69e2ee993b28c2764f
parentf39180efe5737af8467139bf8af7ca27057be87f (diff)
sched/core: Restructure destroy_sched_domain()
There is no point in doing a call_rcu() for each domain, only do a callback for the root sched domain and clean up the entire set in one go. Also make the entire call chain be called destroy_sched_domain*() to remove confusion with the free_sched_domains() call, which does an entirely different thing. Both cpu_attach_domain() callers of destroy_sched_domain() can live without the call_rcu() because at those points the sched_domain hasn't been published yet. Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Mike Galbraith <efault@gmx.de> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: linux-kernel@vger.kernel.org Signed-off-by: Ingo Molnar <mingo@kernel.org>
-rw-r--r--kernel/sched/core.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index b3cd5553ecbb..662d08d7b1df 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -5935,10 +5935,8 @@ static void free_sched_groups(struct sched_group *sg, int free_sgc)
5935 } while (sg != first); 5935 } while (sg != first);
5936} 5936}
5937 5937
5938static void free_sched_domain(struct rcu_head *rcu) 5938static void destroy_sched_domain(struct sched_domain *sd)
5939{ 5939{
5940 struct sched_domain *sd = container_of(rcu, struct sched_domain, rcu);
5941
5942 /* 5940 /*
5943 * If its an overlapping domain it has private groups, iterate and 5941 * If its an overlapping domain it has private groups, iterate and
5944 * nuke them all. 5942 * nuke them all.
@@ -5952,15 +5950,21 @@ static void free_sched_domain(struct rcu_head *rcu)
5952 kfree(sd); 5950 kfree(sd);
5953} 5951}
5954 5952
5955static void destroy_sched_domain(struct sched_domain *sd) 5953static void destroy_sched_domains_rcu(struct rcu_head *rcu)
5956{ 5954{
5957 call_rcu(&sd->rcu, free_sched_domain); 5955 struct sched_domain *sd = container_of(rcu, struct sched_domain, rcu);
5956
5957 while (sd) {
5958 struct sched_domain *parent = sd->parent;
5959 destroy_sched_domain(sd);
5960 sd = parent;
5961 }
5958} 5962}
5959 5963
5960static void destroy_sched_domains(struct sched_domain *sd) 5964static void destroy_sched_domains(struct sched_domain *sd)
5961{ 5965{
5962 for (; sd; sd = sd->parent) 5966 if (sd)
5963 destroy_sched_domain(sd); 5967 call_rcu(&sd->rcu, destroy_sched_domains_rcu);
5964} 5968}
5965 5969
5966/* 5970/*