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


Groups > linux.kernel > #1396936

[RFC][PATCH 2/7] sched: Restructure destroy_sched_domain()

From Peter Zijlstra <peterz@infradead.org>
Newsgroups linux.kernel
Subject [RFC][PATCH 2/7] sched: Restructure destroy_sched_domain()
Date 2016-05-09 13:00 +0200
Message-ID <rwR4S-3QS-15@gated-at.bofh.it> (permalink)
References <rwR4S-3QS-9@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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>
---
 kernel/sched/core.c |   14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -5824,10 +5824,8 @@ static void free_sched_groups(struct sch
 	} while (sg != first);
 }
 
-static void free_sched_domain(struct rcu_head *rcu)
+static void destroy_sched_domain(struct sched_domain *sd)
 {
-	struct sched_domain *sd = container_of(rcu, struct sched_domain, rcu);
-
 	/*
 	 * If its an overlapping domain it has private groups, iterate and
 	 * nuke them all.
@@ -5841,15 +5839,17 @@ static void free_sched_domain(struct rcu
 	kfree(sd);
 }
 
-static void destroy_sched_domain(struct sched_domain *sd)
+static void destroy_sched_domains_rcu(struct rcu_head *rcu)
 {
-	call_rcu(&sd->rcu, free_sched_domain);
+	struct sched_domain *sd = container_of(rcu, struct sched_domain, rcu);
+
+	for (; sd; sd = sd->parent)
+		destroy_sched_domain(sd);
 }
 
 static void destroy_sched_domains(struct sched_domain *sd)
 {
-	for (; sd; sd = sd->parent)
-		destroy_sched_domain(sd);
+	call_rcu(&sd->rcu, destroy_sched_domains_rcu);
 }
 
 /*

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


Thread

[RFC][PATCH 2/7] sched: Restructure destroy_sched_domain() Peter Zijlstra <peterz@infradead.org> - 2016-05-09 13:00 +0200
  Re: [RFC][PATCH 2/7] sched: Restructure destroy_sched_domain() Peter Zijlstra <peterz@infradead.org> - 2016-05-09 16:50 +0200

csiph-web