Received: by 2002:a05:6a10:6d25:0:0:0:0 with SMTP id gq37csp167393pxb; Sat, 11 Sep 2021 01:27:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx2QUxCsRmE1woqPSeRRIQFhx/iV5Oo/G10rwNnIbMdwym5avOWQq2/YVtP7L6XIuA1T9K2 X-Received: by 2002:a92:d18c:: with SMTP id z12mr1230478ilz.59.1631348860404; Sat, 11 Sep 2021 01:27:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631348860; cv=none; d=google.com; s=arc-20160816; b=t3jxnxH8YpIu2Z3YrFjTbV2fDhiS8kfB9tfttHqBYnAz1JNbok/EyRWbJ74RJaw1Xn mlkF2eP9lB/MgTvEOFSpfRJh/VjAeANxdb2U6R1cHaDDrwRPmvfX5padJgfD/dfGz12t df3jYLOmGzpFJYJ40xlAt6b6UDMgA5x3Wg6fvO5dKVe3dv8IsVmrr89z4oavahrUx/We upPVKOQ0eEtEmww82ArR46wDGHLjN/k1Cf0BVufqo/snSVZhUna1mOs5YILYOISfrrXy xeGqMp5BaZ6CuJdWVby5VuO12YhYludU3D46AzbGuEDm778qOkNtXH6rZun8goLlXd5Z VL0A== 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=ykWxIjOCY4jSbazZ+Zw+qZbNl9PLlWPfWBJ6E/OK5bI=; b=dD4Jipy5c+Dxq/Gc6eAhggI4nm4da3HaBH2emH0PvCN4cUlLJc9DEq8CQvJidomykk ab1LU4nCk+6mesewmvtaKZed7Vq6s25tdbph1VcpEz/FHtAbneLRAtx8n5V4BTuFvQN4 NCIVJtpouuhpaWgEKGFBCZNj5OeBkvxESIs+4L4/Ic9XSFYBz1oqrgKgPXtLRZ5YueJW 4Vc5OjKj8Ugsh4GQEmq4BawRH1DYIZZ6tIzklKjEWS4TGIfJ81tKV1xUXc9Zgvvw2Y1V 51Q3/ORYDUy9OJ48DvMdN8BLqSbJR0qC1dUnUv73o6ehEKxotoI4z4oG/MjpRPqAcAUK o+6A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=bycI7GT4; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p16si904062ilc.75.2021.09.11.01.27.28; Sat, 11 Sep 2021 01:27:40 -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; dkim=pass header.i=@gmail.com header.s=20210112 header.b=bycI7GT4; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235439AbhIKI0i (ORCPT + 99 others); Sat, 11 Sep 2021 04:26:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40610 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235334AbhIKI0i (ORCPT ); Sat, 11 Sep 2021 04:26:38 -0400 Received: from mail-pg1-x52c.google.com (mail-pg1-x52c.google.com [IPv6:2607:f8b0:4864:20::52c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 08D90C061574 for ; Sat, 11 Sep 2021 01:25:26 -0700 (PDT) Received: by mail-pg1-x52c.google.com with SMTP id w8so4110311pgf.5 for ; Sat, 11 Sep 2021 01:25:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=ykWxIjOCY4jSbazZ+Zw+qZbNl9PLlWPfWBJ6E/OK5bI=; b=bycI7GT4Jd+JuHzyth+nSnWtKAtFYGoGeFrURamaxVCgXgweylhTD+v37LcQJl9NuR Y2z3/DtHn7rVo7a6D1tNfXxhVWjbxzhZwfh6FJBqimtDXZVhbLbgFxkLyI2ldZHYnDwB KORdkI0x+grn6xpIn6vZzY4VLkabY8bdoE6ul636D5imtFOb1+6aPDHFso+PIOjUqCa1 QrvJBeQKdcyhgv/HpCYxt2Q3oNDQltQsu7Tb6q8tcyPbizURUW2NkIIav5ydZkjx2Anb SBmlngyK2M4JvHwNLF/Dai3NGGF9AJZ5dTj1D5PSHhDwlaknr4F4MocDx7f2euG1uKOd wwEw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=ykWxIjOCY4jSbazZ+Zw+qZbNl9PLlWPfWBJ6E/OK5bI=; b=rordtm8PepR4Tbr6IJ949qHShlDG0146pqYddMNaLnb2ZDG6Tx3e/xBsoQqi7G50zw OM/mEFyqHBbuuCLWRt/zmG/3nfwyY2VOI8WzyXlLA1rbIZ4rRCA/kAK9oy5teT4OHlTe t0/Y2me/rZBHYnaQqwhxqERfdLTlmNuRzE9G7T1EfrD8j/MQPHECGFnCBxO/j1vMOfh0 QTLG69UzE8XtATehrdSyLaZdZNS1NsCxqx5aSXBl+0+Za6xaHf2UIsi0/dvisxF1t5C2 MhClQxQuzTV4ai65REdt8BppLxhccxG2WbgNXyF0A7fFriIMi6jh0FMbleOAfIaltEPi O1SQ== X-Gm-Message-State: AOAM532lVDm/xqijGqNfRGtOAtYo4ZgBCs8Wznw+uSRmXLv1aUAVoRIB 9jJ+t2F/qn9Opgj77EDPOUo= X-Received: by 2002:a05:6a00:882:b0:416:3ddd:afae with SMTP id q2-20020a056a00088200b004163dddafaemr1763710pfj.72.1631348725408; Sat, 11 Sep 2021 01:25:25 -0700 (PDT) Received: from localhost.localdomain ([141.164.38.246]) by smtp.gmail.com with ESMTPSA id p62sm1174051pfg.25.2021.09.11.01.25.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 11 Sep 2021 01:25:24 -0700 (PDT) From: Yafang Shao To: peterz@infradead.org Cc: lkp@intel.com, kbuild-all@lists.01.org, linux-kernel@vger.kernel.org, Yafang Shao Subject: [PATCH peterz-queue:sched/core] sched: fix build warning with W=1 Date: Sat, 11 Sep 2021 08:25:05 +0000 Message-Id: <20210911082505.115758-1-laoar.shao@gmail.com> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org kernel test robot reported some build warnings with W=1 as below, kernel/sched/fair.c:892:34: warning: variable 'stats' set but not used kernel/sched/core.c:10238:42: warning: variable 'stats' set but not used kernel/sched/fair.c:893:29: warning: variable 'p' set but not used kernel/sched/rt.c:1292:29: warning: variable 'p' set but not used kernel/sched/deadline.c:1486:34: warning: variable 'stats' set but not used arch/nds32/include/asm/current.h:10:13: warning: variable '$r25' set but not used These warnings happen when CONFIG_SCHEDSTATS is not set, in which case the schedstat_* functions will be none. We should add '__maybe_unused' to fix it Reported-by: kernel test robot Signed-off-by: Yafang Shao --- kernel/sched/core.c | 4 ++-- kernel/sched/deadline.c | 6 +++--- kernel/sched/fair.c | 12 ++++++------ kernel/sched/rt.c | 6 +++--- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 85e212d3c7ff..7c3476f284d8 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -3462,7 +3462,7 @@ static inline bool rq_has_pinned_tasks(struct rq *rq) static void ttwu_stat(struct task_struct *p, int cpu, int wake_flags) { - struct rq *rq; + struct rq __maybe_unused *rq; if (!schedstat_enabled()) return; @@ -10235,7 +10235,7 @@ static int cpu_cfs_stat_show(struct seq_file *sf, void *v) seq_printf(sf, "throttled_time %llu\n", cfs_b->throttled_time); if (schedstat_enabled() && tg != &root_task_group) { - struct sched_statistics *stats; + struct sched_statistics __maybe_unused *stats; u64 ws = 0; int i; diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c index d2c072b0ef01..f6ececf11725 100644 --- a/kernel/sched/deadline.c +++ b/kernel/sched/deadline.c @@ -1483,7 +1483,7 @@ __schedstats_from_dl_se(struct sched_dl_entity *dl_se) static inline void update_stats_wait_start_dl(struct dl_rq *dl_rq, struct sched_dl_entity *dl_se) { - struct sched_statistics *stats; + struct sched_statistics __maybe_unused *stats; if (!schedstat_enabled()) return; @@ -1495,7 +1495,7 @@ update_stats_wait_start_dl(struct dl_rq *dl_rq, struct sched_dl_entity *dl_se) static inline void update_stats_wait_end_dl(struct dl_rq *dl_rq, struct sched_dl_entity *dl_se) { - struct sched_statistics *stats; + struct sched_statistics __maybe_unused *stats; if (!schedstat_enabled()) return; @@ -1507,7 +1507,7 @@ update_stats_wait_end_dl(struct dl_rq *dl_rq, struct sched_dl_entity *dl_se) static inline void update_stats_enqueue_sleeper_dl(struct dl_rq *dl_rq, struct sched_dl_entity *dl_se) { - struct sched_statistics *stats; + struct sched_statistics __maybe_unused *stats; if (!schedstat_enabled()) return; diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index ea13d3d9e540..4d985d0364bc 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -889,8 +889,8 @@ static void update_curr_fair(struct rq *rq) static inline void update_stats_wait_start_fair(struct cfs_rq *cfs_rq, struct sched_entity *se) { - struct sched_statistics *stats; - struct task_struct *p = NULL; + struct sched_statistics __maybe_unused *stats; + struct task_struct __maybe_unused *p = NULL; if (!schedstat_enabled()) return; @@ -906,8 +906,8 @@ update_stats_wait_start_fair(struct cfs_rq *cfs_rq, struct sched_entity *se) static inline void update_stats_wait_end_fair(struct cfs_rq *cfs_rq, struct sched_entity *se) { - struct sched_statistics *stats; - struct task_struct *p = NULL; + struct sched_statistics __maybe_unused *stats; + struct task_struct __maybe_unused *p = NULL; if (!schedstat_enabled()) return; @@ -932,8 +932,8 @@ update_stats_wait_end_fair(struct cfs_rq *cfs_rq, struct sched_entity *se) static inline void update_stats_enqueue_sleeper_fair(struct cfs_rq *cfs_rq, struct sched_entity *se) { - struct sched_statistics *stats; - struct task_struct *tsk = NULL; + struct sched_statistics __maybe_unused *stats; + struct task_struct __maybe_unused *tsk = NULL; if (!schedstat_enabled()) return; diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c index bb945f8faeca..e19d1e7190cc 100644 --- a/kernel/sched/rt.c +++ b/kernel/sched/rt.c @@ -1288,8 +1288,8 @@ __schedstats_from_rt_se(struct sched_rt_entity *rt_se) static inline void update_stats_wait_start_rt(struct rt_rq *rt_rq, struct sched_rt_entity *rt_se) { + struct task_struct __maybe_unused *p = NULL; struct sched_statistics *stats; - struct task_struct *p = NULL; if (!schedstat_enabled()) return; @@ -1307,8 +1307,8 @@ update_stats_wait_start_rt(struct rt_rq *rt_rq, struct sched_rt_entity *rt_se) static inline void update_stats_enqueue_sleeper_rt(struct rt_rq *rt_rq, struct sched_rt_entity *rt_se) { + struct task_struct __maybe_unused *p = NULL; struct sched_statistics *stats; - struct task_struct *p = NULL; if (!schedstat_enabled()) return; @@ -1337,8 +1337,8 @@ update_stats_enqueue_rt(struct rt_rq *rt_rq, struct sched_rt_entity *rt_se, static inline void update_stats_wait_end_rt(struct rt_rq *rt_rq, struct sched_rt_entity *rt_se) { + struct task_struct __maybe_unused *p = NULL; struct sched_statistics *stats; - struct task_struct *p = NULL; if (!schedstat_enabled()) return; -- 2.17.1