From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752835AbcEIK5c (ORCPT ); Mon, 9 May 2016 06:57:32 -0400 Received: from merlin.infradead.org ([205.233.59.134]:57174 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752648AbcEIK5O (ORCPT ); Mon, 9 May 2016 06:57:14 -0400 Message-Id: <20160509105210.506989560@infradead.org> User-Agent: quilt/0.61-1 Date: Mon, 09 May 2016 12:48:09 +0200 From: Peter Zijlstra To: mingo@kernel.org, linux-kernel@vger.kernel.org Cc: clm@fb.com, matt@codeblueprint.co.uk, mgalbraith@suse.de, tglx@linutronix.de, fweisbec@gmail.com, peterz@infradead.org Subject: [RFC][PATCH 2/7] sched: Restructure destroy_sched_domain() References: <20160509104807.284575300@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline; filename=peterz-sched-kill-sd_busy-1.patch Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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) --- 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); } /*