Received: by 2002:ac0:da4c:0:0:0:0:0 with SMTP id a12csp228340imi; Thu, 21 Jul 2022 20:18:13 -0700 (PDT) X-Google-Smtp-Source: AGRyM1syzrYQj2X391biUEl9i6CrGvAggeAvdR+j3+/MrNOFUu9crIZJL/Vb841Skvzl3agMJyBk X-Received: by 2002:a17:90a:9a91:b0:1f2:34eb:6f8c with SMTP id e17-20020a17090a9a9100b001f234eb6f8cmr5764422pjp.91.1658459892816; Thu, 21 Jul 2022 20:18:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658459892; cv=none; d=google.com; s=arc-20160816; b=gZxwi5HHq3PMYQm5vkRNfYam4wzP3vX6CSt+7AW9iosug/q5vKCGcfvKP9rW8dlqqk AwuKYeR1SNcEdvnrQY3CNvm6UvCJurPpdaAHFdH2ZWm4e73rSbZJDQpyMnO8YvTyGKku L7/uSW26IYPZqpRRjxPHWMYzwKNcCwU1Spj8Mautp/zUvlxZJeUh0B7XUlLgFmLrWHNR O/MNdDGQ90Gw+C1IbtEbDHnR1kAyYOBiD79InFaDEjUmJt63CDtFG59bCxFhNGEwYtsZ 39ue3/3RlYWezi89DQI+h22/5F6jmpJ7ic/CB7HZbg2hxfODb/OCwMYMjg27z2o0hjsy fdHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=FE3ivmnExVKRTwW1u6mrduXZBpbr5Y+rwusJkpThztE=; b=SfhzEBta7jbqWhc3rgHWC81cwr1JFZ/xtgvaXD71ZuMhfzgtVBwRLGzLdAoDhFa358 KOzWUCZzfVJtnNTmuMxAbibQZZNUpYAq3MZAUGX2ZzPm55hEfngcV0eGDpiaF6bbreEK r7B0weWhgkTF9sQv+sBlTzbEwUNGCTPH+mJD9Ha60ASfEiTJQc8PTZrGeGBl32SYkyjP Tnqeil4BfehgrWBm5tvttSi+fSw1v3To+wZpCTSs1AZAVHuUNP4C0RiQBiVanl8Sn2IE 0wWteEH46FKNxPt1Af+TW1louSNSOabEYRSDoUWHo2651Qq4FPR/OgVqt5NmzIBxkNSA A4+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=hRx+gZqM; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e10-20020a170902cf4a00b0016a2dcb8690si4163553plg.484.2022.07.21.20.17.58; Thu, 21 Jul 2022 20:18:12 -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; dkim=pass header.i=@intel.com header.s=Intel header.b=hRx+gZqM; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234183AbiGVCqP (ORCPT + 99 others); Thu, 21 Jul 2022 22:46:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52968 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231768AbiGVCqN (ORCPT ); Thu, 21 Jul 2022 22:46:13 -0400 Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 05AAA1706C; Thu, 21 Jul 2022 19:46:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1658457971; x=1689993971; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=kZruc0Eurt8MDfbaeLpfrOBl5EnpGijDalH8rviQon4=; b=hRx+gZqMk4Kk7/6ixbOISVF1XiU0zHY6Si5hXuEIkAJLpEIfJKPlefC8 c41aGhEGOqIV0AphvGaT74V4XR4nVv7SYZG/s0F4tHIwWee9WscyEDgPx F6WSyep8OWjosWbDyH6MbV99q72HSgoB7wzXrC9ugh2PmVPAv5VSCP/VR SkgfqLLKBSRDaA1HrCDvsrASwIjN0J7+Qo7O0tJSHhmSUnahqBgNI7Hem waui6ouOKGJyldAU2Np/uHOIvCI0gSYPUuWMuhwwwB0HAdRWhxRaCmmZa oTu/rLT09rPUVmzdw/P+RxTs0XgdMPYV8ufPzAKZcqWAowOF5wgLe+LVm w==; X-IronPort-AV: E=McAfee;i="6400,9594,10415"; a="267618616" X-IronPort-AV: E=Sophos;i="5.93,184,1654585200"; d="scan'208";a="267618616" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Jul 2022 19:46:10 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.93,184,1654585200"; d="scan'208";a="725274937" Received: from liuzhao-optiplex-7080.sh.intel.com ([10.239.160.132]) by orsmga004.jf.intel.com with ESMTP; 21 Jul 2022 19:46:08 -0700 From: Zhao Liu To: "Rafael J . Wysocki" , Viresh Kumar Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, trivial@kernel.org, Rusty Russell , Zhenyu Wang , Zhao Liu , Zhao Liu Subject: [patch] cpufreq: ondemand: Use cpumask_var_t for on-stack cpu mask Date: Fri, 22 Jul 2022 10:50:24 +0800 Message-Id: <20220722025024.454626-1-zhao1.liu@linux.intel.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-5.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE 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 A cpumask structure on the stack can cause a warning with CONFIG_NR_CPUS=8192 (e.g. Ubuntu 22.04 uses this): drivers/cpufreq/cpufreq_ondemand.c: In function 'od_set_powersave_bias': drivers/cpufreq/cpufreq_ondemand.c:449:1: warning: the frame size of 1032 bytes is larger than 1024 bytes [-Wframe-larger-than=] 449 | } | ^ CONFIG_CPUMASK_OFFSTACK=y is enabled by default for most distros, and hence we can work around the warning by using cpumask_var_t. Signed-off-by: Zhao Liu --- drivers/cpufreq/cpufreq_ondemand.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/drivers/cpufreq/cpufreq_ondemand.c b/drivers/cpufreq/cpufreq_ondemand.c index e8fbf970ff07..c52d19d67557 100644 --- a/drivers/cpufreq/cpufreq_ondemand.c +++ b/drivers/cpufreq/cpufreq_ondemand.c @@ -416,10 +416,13 @@ static struct dbs_governor od_dbs_gov = { static void od_set_powersave_bias(unsigned int powersave_bias) { unsigned int cpu; - cpumask_t done; + cpumask_var_t done; + + if (!alloc_cpumask_var(&done, GFP_KERNEL)) + return; default_powersave_bias = powersave_bias; - cpumask_clear(&done); + cpumask_clear(done); cpus_read_lock(); for_each_online_cpu(cpu) { @@ -428,7 +431,7 @@ static void od_set_powersave_bias(unsigned int powersave_bias) struct dbs_data *dbs_data; struct od_dbs_tuners *od_tuners; - if (cpumask_test_cpu(cpu, &done)) + if (cpumask_test_cpu(cpu, done)) continue; policy = cpufreq_cpu_get_raw(cpu); @@ -439,13 +442,15 @@ static void od_set_powersave_bias(unsigned int powersave_bias) if (!policy_dbs) continue; - cpumask_or(&done, &done, policy->cpus); + cpumask_or(done, done, policy->cpus); dbs_data = policy_dbs->dbs_data; od_tuners = dbs_data->tuners; od_tuners->powersave_bias = default_powersave_bias; } cpus_read_unlock(); + + free_cpumask_var(done); } void od_register_powersave_bias_handler(unsigned int (*f) -- 2.34.1