Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3643044pxf; Mon, 29 Mar 2021 07:43:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzCyEftNT+FBzUj6fwStwv+KauvGhBhzVaE1kpcF5IH93wVb3KkdFGXb2kGSN8okkTXWpSB X-Received: by 2002:a17:907:3e21:: with SMTP id hp33mr28302615ejc.313.1617029025250; Mon, 29 Mar 2021 07:43:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617029025; cv=none; d=google.com; s=arc-20160816; b=MxJM+xCXcPbJ59jBO01Op5j8AyBlBtxwRAV71ci3yVi9PbJAbwsJyx35IYsQALW4th p45RPTWlA3AULwu4YLJjrphrn3eGuy44ZL3AjxMm6rDSqDcKEWEaKCSSzLLmFy4C9t6u qt3Hfo2PruDeLfXGahTZRGWReDfFZRz+YeAu8i/PkoVWiCRVEtzmVCdX7hriKvRKVdCM AOBNNiVYJxKbuUBCcgQJErJTtq30yMLFMGCHFbBUo9PeWO7/N3oDOTWh0E2tOg8wnhoQ +jOiJIRGTZiMovDqcw8kA1+Nh8IPlRuEq1zZFUQ383helokLhlLeCm/wrUKZw16WjEW+ BFeg== 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; bh=cBSgtdKbo0q2v0/HD6TCFda4fQ87F27FQCJMgb8FXUM=; b=T7T2wf7U+JNQZQQS9fAxdMEdXzxLODcKodUEjy8MlilwXNf54olA2rUB9KQQih4q/0 g5G2IvwKpwKDhSDXjk1CzEz6nRElS078KgYt4gt0u7wFK2PisVutjX14NI5DXzgpH9kh 1oxHqcm6WWMmbie53j5uGGGyrA2Mnx1RWH2YqIj1g+SggWVN6F5KsylDSxSSn/3zP02h PetJOwhhEF0ATq9KDu4MtB0ySvRVBHS0uLYpbD/PyvP6TV33ibqKJ73zL1K87jgXoqdJ 8fZqQQaMfDZMlKCInkCiKkWKkC8JV/AwUyPLOGj/YWZMc40d5XyfSLwbYwZhHXm1YZy8 xL/Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gt5si12843026ejb.181.2021.03.29.07.43.22; Mon, 29 Mar 2021 07:43:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229628AbhC2OmV (ORCPT + 99 others); Mon, 29 Mar 2021 10:42:21 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:14188 "EHLO szxga04-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230237AbhC2Ol4 (ORCPT ); Mon, 29 Mar 2021 10:41:56 -0400 Received: from DGGEMS414-HUB.china.huawei.com (unknown [172.30.72.60]) by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4F8FZs6jmxzmbjj; Mon, 29 Mar 2021 22:39:17 +0800 (CST) Received: from localhost (10.174.179.96) by DGGEMS414-HUB.china.huawei.com (10.3.19.214) with Microsoft SMTP Server id 14.3.498.0; Mon, 29 Mar 2021 22:41:46 +0800 From: YueHaibing To: , , , , , , , , CC: , YueHaibing Subject: [PATCH v2 -next] sched/fair: Fix unused function warning Date: Mon, 29 Mar 2021 22:40:29 +0800 Message-ID: <20210329144029.29200-1-yuehaibing@huawei.com> X-Mailer: git-send-email 2.10.2.windows.1 MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-Originating-IP: [10.174.179.96] X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org while CONFIG_NO_HZ_COMMON is not enabled, gcc warn this: kernel/sched/fair.c:8398:13: warning: ‘update_nohz_stats’ defined but not used [-Wunused-function] static bool update_nohz_stats(struct rq *rq) ^~~~~~~~~~~~~~~~~ Move update_nohz_stats() to #ifdef checking this. Fixes: 0826530de3cb ("sched/fair: Remove update of blocked load from newidle_balance") Signed-off-by: YueHaibing Reviewed-by: Vincent Guittot --- v2: Add Fixes tag, also move update_nohz_stats() closer to its only caller _nohz_idle_balance() --- kernel/sched/fair.c | 40 ++++++++++++++++++---------------------- 1 file changed, 18 insertions(+), 22 deletions(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 6d73bdbb2d40..2a20ada83cbb 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -8395,28 +8395,6 @@ group_type group_classify(unsigned int imbalance_pct, return group_has_spare; } -static bool update_nohz_stats(struct rq *rq) -{ -#ifdef CONFIG_NO_HZ_COMMON - unsigned int cpu = rq->cpu; - - if (!rq->has_blocked_load) - return false; - - if (!cpumask_test_cpu(cpu, nohz.idle_cpus_mask)) - return false; - - if (!time_after(jiffies, READ_ONCE(rq->last_blocked_load_update_tick))) - return true; - - update_blocked_averages(cpu); - - return rq->has_blocked_load; -#else - return false; -#endif -} - /** * update_sg_lb_stats - Update sched_group's statistics for load balancing. * @env: The load balancing environment. @@ -10380,6 +10358,24 @@ void nohz_balance_enter_idle(int cpu) WRITE_ONCE(nohz.has_blocked, 1); } +static bool update_nohz_stats(struct rq *rq) +{ + unsigned int cpu = rq->cpu; + + if (!rq->has_blocked_load) + return false; + + if (!cpumask_test_cpu(cpu, nohz.idle_cpus_mask)) + return false; + + if (!time_after(jiffies, READ_ONCE(rq->last_blocked_load_update_tick))) + return true; + + update_blocked_averages(cpu); + + return rq->has_blocked_load; +} + /* * Internal function that runs load balance for all idle cpus. The load balance * can be a simple update of blocked load or a complete load balance with -- 2.17.1