From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934692AbeE2NnA (ORCPT ); Tue, 29 May 2018 09:43:00 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:50676 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S934358AbeE2NmQ (ORCPT ); Tue, 29 May 2018 09:42:16 -0400 From: Waiman Long To: Tejun Heo , Li Zefan , Johannes Weiner , Peter Zijlstra , Ingo Molnar Cc: cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, kernel-team@fb.com, pjt@google.com, luto@amacapital.net, Mike Galbraith , torvalds@linux-foundation.org, Roman Gushchin , Juri Lelli , Patrick Bellasi , Waiman Long Subject: [PATCH v9 6/7] cpuset: Don't rebuild sched domains if cpu changes in non-domain root Date: Tue, 29 May 2018 09:41:33 -0400 Message-Id: <1527601294-3444-7-git-send-email-longman@redhat.com> In-Reply-To: <1527601294-3444-1-git-send-email-longman@redhat.com> References: <1527601294-3444-1-git-send-email-longman@redhat.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org With the cpuset v1, any changes to the list of allowable CPUs in a cpuset may cause changes in the sched domain configuration depending on the load balancing states and the cpu lists of its parent and its children. With cpuset v2 (on default hierarchy), there are more restrictions on how the load balancing state of a cpuset can change. As a result, only changes made in a sched domain root will cause possible changes to the corresponding sched domain. CPU changes to any of the non-domain root cpusets will not cause changes in the sched domain configuration. As a result, we don't need to call rebuild_sched_domains_locked() for changes in a non-domain root cpuset saving precious cpu cycles. Signed-off-by: Waiman Long --- kernel/cgroup/cpuset.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c index f6ae483..9513f90 100644 --- a/kernel/cgroup/cpuset.c +++ b/kernel/cgroup/cpuset.c @@ -971,11 +971,15 @@ static void update_cpumasks_hier(struct cpuset *cs, struct cpumask *new_cpus) update_tasks_cpumask(cp); /* - * If the effective cpumask of any non-empty cpuset is changed, - * we need to rebuild sched domains. + * On legacy hierarchy, if the effective cpumask of any non- + * empty cpuset is changed, we need to rebuild sched domains. + * On default hiearchy, the cpuset needs to be a sched + * domain root as well. */ if (!cpumask_empty(cp->cpus_allowed) && - is_sched_load_balance(cp)) + is_sched_load_balance(cp) && + (!cgroup_subsys_on_dfl(cpuset_cgrp_subsys) || + is_sched_domain_root(cp))) need_rebuild_sched_domains = true; rcu_read_lock(); -- 1.8.3.1 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on archive.lwn.net X-Spam-Level: X-Spam-Status: No, score=-5.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham autolearn_force=no version=3.4.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by archive.lwn.net (Postfix) with ESMTP id 66A6C7DF8E for ; Tue, 29 May 2018 13:45:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934648AbeE2Nm7 (ORCPT ); Tue, 29 May 2018 09:42:59 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:50676 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S934358AbeE2NmQ (ORCPT ); Tue, 29 May 2018 09:42:16 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id AA9F64023112; Tue, 29 May 2018 13:42:15 +0000 (UTC) Received: from llong.com (dhcp-17-81.bos.redhat.com [10.18.17.81]) by smtp.corp.redhat.com (Postfix) with ESMTP id CE7FD2315C; Tue, 29 May 2018 13:42:14 +0000 (UTC) From: Waiman Long To: Tejun Heo , Li Zefan , Johannes Weiner , Peter Zijlstra , Ingo Molnar Cc: cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, kernel-team@fb.com, pjt@google.com, luto@amacapital.net, Mike Galbraith , torvalds@linux-foundation.org, Roman Gushchin , Juri Lelli , Patrick Bellasi , Waiman Long Subject: [PATCH v9 6/7] cpuset: Don't rebuild sched domains if cpu changes in non-domain root Date: Tue, 29 May 2018 09:41:33 -0400 Message-Id: <1527601294-3444-7-git-send-email-longman@redhat.com> In-Reply-To: <1527601294-3444-1-git-send-email-longman@redhat.com> References: <1527601294-3444-1-git-send-email-longman@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Tue, 29 May 2018 13:42:15 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Tue, 29 May 2018 13:42:15 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'longman@redhat.com' RCPT:'' Sender: linux-doc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-doc@vger.kernel.org With the cpuset v1, any changes to the list of allowable CPUs in a cpuset may cause changes in the sched domain configuration depending on the load balancing states and the cpu lists of its parent and its children. With cpuset v2 (on default hierarchy), there are more restrictions on how the load balancing state of a cpuset can change. As a result, only changes made in a sched domain root will cause possible changes to the corresponding sched domain. CPU changes to any of the non-domain root cpusets will not cause changes in the sched domain configuration. As a result, we don't need to call rebuild_sched_domains_locked() for changes in a non-domain root cpuset saving precious cpu cycles. Signed-off-by: Waiman Long --- kernel/cgroup/cpuset.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c index f6ae483..9513f90 100644 --- a/kernel/cgroup/cpuset.c +++ b/kernel/cgroup/cpuset.c @@ -971,11 +971,15 @@ static void update_cpumasks_hier(struct cpuset *cs, struct cpumask *new_cpus) update_tasks_cpumask(cp); /* - * If the effective cpumask of any non-empty cpuset is changed, - * we need to rebuild sched domains. + * On legacy hierarchy, if the effective cpumask of any non- + * empty cpuset is changed, we need to rebuild sched domains. + * On default hiearchy, the cpuset needs to be a sched + * domain root as well. */ if (!cpumask_empty(cp->cpus_allowed) && - is_sched_load_balance(cp)) + is_sched_load_balance(cp) && + (!cgroup_subsys_on_dfl(cpuset_cgrp_subsys) || + is_sched_domain_root(cp))) need_rebuild_sched_domains = true; rcu_read_lock(); -- 1.8.3.1 -- To unsubscribe from this list: send the line "unsubscribe linux-doc" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html