Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp5772050ioo; Wed, 1 Jun 2022 12:14:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzE2C5gxQ1nR3ESvQ1niVJjmJj8qqfCum2BtYbXWAhJLYvz+0dWcprl6JVfI/YXpmQhI0nc X-Received: by 2002:a17:90b:3b88:b0:1e6:7aa2:4301 with SMTP id pc8-20020a17090b3b8800b001e67aa24301mr1222392pjb.118.1654110863541; Wed, 01 Jun 2022 12:14:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654110863; cv=none; d=google.com; s=arc-20160816; b=VeSAC0LSLWNzt7fmnZ9du8v6z8h2cvoR0sbXH41Utx9RN4pPAUyBNzGTMYmaFW9SkL fugeMZr7+Zzf/UZxl6dux3YG5MNlvrLKxPY4a5YUo2JeW8FBvSLYXlluljjHXVN+lycF bTZ+6XKRkHNIFOhk4NWSGWCvPOGImnkysdqAQ73qkUup+eaQJkQXtTrGROT5CXkhwByi KppI6bPfLAqsukqqORwBYam4BasWitFgRbYGZtee9weFcwJhFpcTRSB1Mmxz+912lc4c 9C1EjsP4p3QJNx3dmjcXxVCopSOKx4gF02D3QUSl2MkXdXX8kfqFbkzhwMT9dWNwQMJm egbQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=j5IXWoaMXdUFpAC2mqOl76sjPiXiB+0iTf3Ze6khEgs=; b=kuNtZg3C9rwLhjMMLieXw77fyuaoT2k3rXThO4fWCbOqdU4qH6thzXm7hPnk6jl5T8 m/DjvL9mmGXY8eWFREm1/OjBd/fkK+1ZuzvHNgzOt8MXDBl0jbzxSE6J4efBfZ8wWsuf jWwnD/mKcTYShHr1rBfC0B2kxplelgo0wJU0cPv2+26f4s5jg5MnuFqgXTYMWr8lhtV8 u2q3A+T7KJBn+1X1AlH4Mqz6gQOHjyOs5MFh2pmIcnHF5hFVkmyV0u7qfjsoUC/sm7cy A4WyAjv4hGXGTY66lJ0l8pJceoRRb0bpAnd4HwlGJadYz1JhGC+kqovteRNQpSfgb91R gPIg== ARC-Authentication-Results: i=1; mx.google.com; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id w20-20020a631614000000b003f6456597b1si3213511pgl.665.2022.06.01.12.14.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Jun 2022 12:14:23 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id AB33913F1F8; Wed, 1 Jun 2022 11:52:32 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242352AbiFAIpW (ORCPT + 99 others); Wed, 1 Jun 2022 04:45:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41618 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350945AbiFAIpO (ORCPT ); Wed, 1 Jun 2022 04:45:14 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 8F1A569721 for ; Wed, 1 Jun 2022 01:45:13 -0700 (PDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 290DE23A; Wed, 1 Jun 2022 01:45:13 -0700 (PDT) Received: from [192.168.178.6] (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 2A1233F73D; Wed, 1 Jun 2022 01:45:11 -0700 (PDT) Message-ID: Date: Wed, 1 Jun 2022 10:45:00 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.8.1 Subject: Re: [PATCH v2] sched/fair: static cpumasks for load balance Content-Language: en-US To: Bing Huang , peterz@infradead.org Cc: brauner@kernel.org, bristot@redhat.com, bsegall@google.com, juri.lelli@redhat.com, linux-kernel@vger.kernel.org, mgorman@suse.de, mingo@redhat.com, rostedt@goodmis.org, vincent.guittot@linaro.org References: <20220531031255.30966-1-huangbing@kylinos.cn> From: Dietmar Eggemann In-Reply-To: <20220531031255.30966-1-huangbing@kylinos.cn> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A, RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 31/05/2022 05:12, Bing Huang wrote: > The both cpu mask load_balance_mask and select_idle_mask just only used > in fair.c, but allocation in core.c in CONFIG_CPUMASK_OFFSTACK=y case, > and global via declare per cpu variations. More or less, it looks wired. > > Signed-off-by: Bing Huang > --- > > v2: move load_balance_mask and select_idle_mask allocation from > sched_init() to init_sched_fair_class() This would align CFS with RT (local_cpu_mask) and DL (local_cpu_mask_dl). [...] > @@ -11841,6 +11841,16 @@ void show_numa_stats(struct task_struct *p, struct seq_file *m) > __init void init_sched_fair_class(void) > { > #ifdef CONFIG_SMP `int i` missing for DEBUG_PER_CPU_MAPS/CONFIG_CPUMASK_OFFSTACK case. > + > +#ifdef CONFIG_CPUMASK_OFFSTACK > + for_each_possible_cpu(i) { > + per_cpu(load_balance_mask, i) = (cpumask_var_t)kzalloc_node( > + cpumask_size(), GFP_KERNEL, cpu_to_node(i)); > + per_cpu(select_idle_mask, i) = (cpumask_var_t)kzalloc_node( > + cpumask_size(), GFP_KERNEL, cpu_to_node(i)); > + } > +#endif > + What about: diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 98319b654788..9ef5133c72d6 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -11811,15 +11811,14 @@ void show_numa_stats(struct task_struct *p, struct seq_file *m) __init void init_sched_fair_class(void) { #ifdef CONFIG_SMP + int i; -#ifdef CONFIG_CPUMASK_OFFSTACK for_each_possible_cpu(i) { - per_cpu(load_balance_mask, i) = (cpumask_var_t)kzalloc_node( - cpumask_size(), GFP_KERNEL, cpu_to_node(i)); - per_cpu(select_idle_mask, i) = (cpumask_var_t)kzalloc_node( - cpumask_size(), GFP_KERNEL, cpu_to_node(i)); + zalloc_cpumask_var_node(&per_cpu(load_balance_mask, i), + GFP_KERNEL, cpu_to_node(i)); + zalloc_cpumask_var_node(&per_cpu(select_idle_mask, i), + GFP_KERNEL, cpu_to_node(i)); } -#endif to get rid of the #ifdef ? We do the same for RT (local_cpu_mask) and DL (local_cpu_mask_dl). [...]