Received: by 2002:ac0:e34a:0:0:0:0:0 with SMTP id g10csp129189imn; Mon, 25 Jul 2022 11:46:26 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uXA9RUm98A4diEqXJ86L3nrJ7vWhmFfjUUsmyooCwIs7i3rFaR5ygw50/Aj12twiVUw3g1 X-Received: by 2002:a17:907:6d1d:b0:72b:6d8a:ca64 with SMTP id sa29-20020a1709076d1d00b0072b6d8aca64mr11096513ejc.371.1658774786092; Mon, 25 Jul 2022 11:46:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658774786; cv=none; d=google.com; s=arc-20160816; b=Pc5f79TL/if4oZlVgWJl0Ppr6GihSBURxPZcgFP8hESltmlZaJ7K1z2PO4qOGZGFcW AUQqBz2C+F+2qqk5V9HN7bnyHK24cXDw53sUrbtYMMHl9qThCiNqvYS42E72bDU6MWTu DFLt2U1/AIm4dJyhbuqYdKPhD8S9vO8HNtbjmYwwkWNKHaMaeacOlphFFU2S4AFT+l3y 62EQDXfqHe6vm5nJ30C/cvQU1TjTJYN8J92AOonRL0ZGVfs6dstLcFXnkNfXP7QkewTc oDHmn5c1jwhPedaOogx2tuS6IPMQyHhdnkMy4pK3F8mMmHmVE1/KH1WlIeTSE0p8wuCr EkJw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version; bh=KNBJWlyA9+07rg2cUyhq9BlXYJZB1wgorDKxzUoss4M=; b=LiwljdnBS9IUCeYZxVEU7RnZjDPOSOeRCE62/ne+yFF6UlRV0h5CVPzaBRXCh7Xn1P +zw2L6wd44ibOQTBkS4qwnF+N/4ptxGynBjDQgjlMjIaHrubBnXryexOq76ue1BBpGOi YKngTkitXKrkU7VNVpbqwFN9b0PPNTFQKSS4rEVC2PmArEPEUbnq+4FcoGPxtfzKF7TY OuDwnjLWXYDJ0CgV0YrXCeHpLZ7XNrYQrloQ2OBKGpcesNc+K+Ka21yK7L3vVH0y/+79 qQxgdCs5p1Hv+6ef6R1SVDu87mxYUCUawhcY92NjpAP8CdCl1G7J03ESIhEjp/12IBWo 2f8w== 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x3-20020a05640226c300b0043c1ab7956bsi2301128edd.104.2022.07.25.11.46.00; Mon, 25 Jul 2022 11:46:26 -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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234320AbiGYSjS (ORCPT + 99 others); Mon, 25 Jul 2022 14:39:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50812 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235752AbiGYSjO (ORCPT ); Mon, 25 Jul 2022 14:39:14 -0400 Received: from mail-yb1-f176.google.com (mail-yb1-f176.google.com [209.85.219.176]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8994812606; Mon, 25 Jul 2022 11:39:13 -0700 (PDT) Received: by mail-yb1-f176.google.com with SMTP id k85so21629298ybk.7; Mon, 25 Jul 2022 11:39:13 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc; bh=KNBJWlyA9+07rg2cUyhq9BlXYJZB1wgorDKxzUoss4M=; b=EVpfLVATxqGT4MAojDA8Agv3hxQH671FH00YMJMC85q8ddhnVawmHAovD0CLN1XTid SGS/eAagH1yvxA3Q2yx4Fq1YPcYXP9+JoCPnVA322D87ZXaWPYXOXCW6Y7/xh1FjZZpv upyX5twC7NqUASvakYBc2Q2Q0J1WJpr17LFYmkGiKyAlA8vP4YV0B5a0kFxI6L9PkHAX DnrOW7Fz36mymHgVvSeN1Go6XCeFjCnM5XrsMBG5sMEPJL6U149szq6U9CCCkbIkvY7m dF1Xl7M6MhSVPUCDN3ITLKHN+D0WNl+ozqvgNTpDmgwcAu5cGF1XrjBCxugtOZQwDHY+ gckQ== X-Gm-Message-State: AJIora/M0mFmPOu6Uw8ojE7cNfbgHqJ6dSo1CVMYZ2gi2gKFOC7FPess 45qVMv0GCCkcbaBEdFuw4xh1JHRUYA8ov1hniaE= X-Received: by 2002:a25:664f:0:b0:66c:d0f4:36cc with SMTP id z15-20020a25664f000000b0066cd0f436ccmr9894684ybm.482.1658774352789; Mon, 25 Jul 2022 11:39:12 -0700 (PDT) MIME-Version: 1.0 References: <20220722025024.454626-1-zhao1.liu@linux.intel.com> <20220725103053.o45ly6rnq7vyfdup@vireshk-i7> In-Reply-To: <20220725103053.o45ly6rnq7vyfdup@vireshk-i7> From: "Rafael J. Wysocki" Date: Mon, 25 Jul 2022 20:39:01 +0200 Message-ID: Subject: Re: [patch] cpufreq: ondemand: Use cpumask_var_t for on-stack cpu mask To: Viresh Kumar , Zhao Liu Cc: "Rafael J . Wysocki" , Linux PM , Linux Kernel Mailing List , Jiri Kosina , Rusty Russell , Zhenyu Wang , Zhao Liu Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no 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 Mon, Jul 25, 2022 at 12:30 PM Viresh Kumar wrote: > > On 22-07-22, 10:50, Zhao Liu wrote: > > 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) > > Acked-by: Viresh Kumar Applied as 5.20 material, thanks!