Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp6221549ioo; Thu, 2 Jun 2022 01:27:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwdEDtXuYQvxA4/rhZPdMVICf7EwzseZEw495s3Bn8eHJoPK60pYiHjI4OjFca/aHAQPrRd X-Received: by 2002:a05:6a00:1506:b0:518:bcdd:6a33 with SMTP id q6-20020a056a00150600b00518bcdd6a33mr3773816pfu.27.1654158431800; Thu, 02 Jun 2022 01:27:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654158431; cv=none; d=google.com; s=arc-20160816; b=W04YWwbl7f8o45czBGCIfMgdAzOk2jcUH96BvH2tyD4DLE1L+rIghgx1uCBM+6nSIY saqb/vSKE0IAliwoWAzlKCVvmi/xw5RjPzp7N8RDZwVuRqE2Z1AqbAEpS7A7ehJJh3VV Xi35n1C54NebCid3PmVZf50E50uGMUjwg8KawD6koTD80aVisD1gOu/Bq6CLmfvXifVJ /BBrleHzpF4XbDMXdMIyTBBN8M4IFNzum/7q8dtIEZBJK/CpFstiO/svOV9/8w/NJ8gw ZWsI+eySqPDyJraMj97OG33Iz+7JhD1LElJp9GmrpSE4+leVpQpVjxtr/Un8TxBGIjnZ nu0A== 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=atBz1b8MBd3O/y34LHzWZqg3cGWtbvLw13WrNenO6j8=; b=xfBlYw642X1DlSergp2uITGiBBdricI0PyzpOTMBFgo36rumG99fQ2GPXrOfMGWEZM 7SPJXKRw1risrOcBMi25FveFjLGAm+bc9hBdwQ8k5kJCpC/L9SjFKUs/UM+oGbtrO6Uv ezJevYAp+7ZQZj0gUVJnX3d6sPGdHTEL77eAxOPzs0c5gEjJ7/9HaVjCAsp0AGQjoVy/ 4kZKo0olLSWcAsVgwVUctmyIxNtwNdRPQ7Z4JG0Pw3o3Y+tQC4GA4MtzzZprDZLCxdNh dg3EnV+pIOdFU6EcoVrzhUjw6R/Ut3r9iXDMjcrUHSQSRt7afJ2kQCrk6DBYb/xVhSGh O2Ow== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k13-20020a63ab4d000000b003fa34df0430si5223378pgp.453.2022.06.02.01.26.59; Thu, 02 Jun 2022 01:27:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229887AbiFBEwt (ORCPT + 99 others); Thu, 2 Jun 2022 00:52:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42192 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229864AbiFBEwl (ORCPT ); Thu, 2 Jun 2022 00:52:41 -0400 Received: from nksmu.kylinos.cn (mailgw.kylinos.cn [123.150.8.42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1C05CC70 for ; Wed, 1 Jun 2022 21:52:38 -0700 (PDT) X-UUID: 4ff4440716a24f549134accc90c5eaa0-20220602 X-Spam-Fingerprint: 0 X-GW-Reason: 13103 X-Policy-Incident: 5pS25Lu25Lq66LaF6L+HMTDkurrpnIDopoHlrqHmoLg= X-Content-Feature: ica/max.line-size 91 audit/email.address 1 X-CPASD-INFO: a618c05e78804ae1b72ad106831ec851@qoZrWJBiY5VjWHp8g6Swa4JoYpGUXVC Fem1RlZFoYVGVhH5xTWJsXVKBfG5QZWNdYVN_eGpQYl9gZFB5i3-XblBgXoZgUZB3sHhrWJNeZQ== X-CLOUD-ID: a618c05e78804ae1b72ad106831ec851 X-CPASD-SUMMARY: SIP:-1,APTIP:-2.0,KEY:0.0,FROMBLOCK:1,OB:0.0,URL:-5,TVAL:158. 0,ESV:0.0,ECOM:-5.0,ML:0.0,FD:0.0,CUTS:223.0,IP:-2.0,MAL:-5.0,PHF:-5.0,PHC:-5 .0,SPF:4.0,EDMS:-5,IPLABEL:4480.0,FROMTO:0,AD:0,FFOB:0.0,CFOB:0.0,SPC:0,SIG:- 5,AUF:10,DUF:42064,ACD:302,DCD:404,SL:0,EISP:0,AG:0,CFC:0.786,CFSR:0.04,UAT:0 ,RAF:2,IMG:-5.0,DFA:0,DTA:0,IBL:-2.0,ADI:-5,SBL:0,REDM:0,REIP:0,ESB:0,ATTNUM: 0,EAF:0,CID:-5.0,VERSION:2.3.17 X-CPASD-ID: 4ff4440716a24f549134accc90c5eaa0-20220602 X-CPASD-BLOCK: 1000 X-CPASD-STAGE: 1 X-UUID: 4ff4440716a24f549134accc90c5eaa0-20220602 X-User: huangbing@kylinos.cn Received: from [172.20.108.189] [(116.128.244.169)] by nksmu.kylinos.cn (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES128-GCM-SHA256 128/128) with ESMTP id 460479508; Thu, 02 Jun 2022 10:59:48 +0800 Message-ID: <6940568c-a9e9-bf6d-0071-25e00c42f621@kylinos.cn> Date: Thu, 2 Jun 2022 10:56:48 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1 Subject: Re: [PATCH v2] sched/fair: static cpumasks for load balance Content-Language: en-US To: Dietmar Eggemann , 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: "huangbing@kylinos" In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-3.2 required=5.0 tests=BAYES_00,KHOP_HELO_FCRDNS, NICE_REPLY_A,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE,T_SPF_PERMERROR autolearn=ham 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 6/1/22 16:45, Dietmar Eggemann wrote: > 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. sorry,my fault. > >> + >> +#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). good suggestion, thanks very much. happy to do that. > > [...]