From nobody Mon Jun 22 19:28:41 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1D0E5C433EF for ; Fri, 18 Mar 2022 02:36:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231872AbiCRChf (ORCPT ); Thu, 17 Mar 2022 22:37:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43474 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231853AbiCRChc (ORCPT ); Thu, 17 Mar 2022 22:37:32 -0400 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B38692B962A for ; Thu, 17 Mar 2022 19:36:14 -0700 (PDT) Received: from canpemm500005.china.huawei.com (unknown [172.30.72.53]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4KKSkp0dF6zCqhq; Fri, 18 Mar 2022 10:34:10 +0800 (CST) Received: from huawei.com (10.175.104.82) by canpemm500005.china.huawei.com (7.192.104.229) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.21; Fri, 18 Mar 2022 10:36:12 +0800 From: Baisong Zhong To: , , , , , , , , CC: , Subject: [PATCH -next] sched/rt: fix build error when CONFIG_SYSCTL is disable Date: Fri, 18 Mar 2022 10:54:17 +0800 Message-ID: <20220318025417.3683430-1-zhongbaisong@huawei.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.175.104.82] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To canpemm500005.china.huawei.com (7.192.104.229) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Avoid random build errors which do not select CONFIG_SYSCTL by depending on it in Kconfig. This fixes the following warning: In file included from kernel/sched/build_policy.c:43: At top level: kernel/sched/rt.c:3017:12: error: =E2=80=98sched_rr_handler=E2=80=99 define= d but not used [-Werror=3Dunused-function] 3017 | static int sched_rr_handler(struct ctl_table *table, int write, voi= d *buffer, | ^~~~~~~~~~~~~~~~ kernel/sched/rt.c:2978:12: error: =E2=80=98sched_rt_handler=E2=80=99 define= d but not used [-Werror=3Dunused-function] 2978 | static int sched_rt_handler(struct ctl_table *table, int write, voi= d *buffer, | ^~~~~~~~~~~~~~~~ cc1: all warnings being treated as errors make[2]: *** [scripts/Makefile.build:310: kernel/sched/build_policy.o] Erro= r 1 make[1]: *** [scripts/Makefile.build:638: kernel/sched] Error 2 make[1]: *** Waiting for unfinished jobs.... Reported-by: Hulk Robot Signed-off-by: Baisong Zhong --- kernel/sched/rt.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c index 71791be36065..ee319581b1cd 100644 --- a/kernel/sched/rt.c +++ b/kernel/sched/rt.c @@ -5,7 +5,6 @@ */ =20 int sched_rr_timeslice =3D RR_TIMESLICE; -static int sysctl_sched_rr_timeslice =3D (MSEC_PER_SEC / HZ) * RR_TIMESLIC= E; /* More than 4 hours if BW_SHIFT equals 20. */ static const u64 max_rt_runtime =3D MAX_BW; =20 @@ -25,11 +24,12 @@ unsigned int sysctl_sched_rt_period =3D 1000000; */ int sysctl_sched_rt_runtime =3D 950000; =20 +#ifdef CONFIG_SYSCTL +static int sysctl_sched_rr_timeslice =3D (MSEC_PER_SEC / HZ) * RR_TIMESLIC= E; static int sched_rt_handler(struct ctl_table *table, int write, void *buff= er, size_t *lenp, loff_t *ppos); static int sched_rr_handler(struct ctl_table *table, int write, void *buff= er, size_t *lenp, loff_t *ppos); -#ifdef CONFIG_SYSCTL static struct ctl_table sched_rt_sysctls[] =3D { { .procname =3D "sched_rt_period_us", @@ -2911,6 +2911,7 @@ long sched_group_rt_period(struct task_group *tg) return rt_period_us; } =20 +#ifdef CONFIG_SYSCTL static int sched_rt_global_constraints(void) { int ret =3D 0; @@ -2930,8 +2931,11 @@ int sched_rt_can_attach(struct task_group *tg, struc= t task_struct *tsk) =20 return 1; } +#endif /* CONFIG_SYSCTL */ =20 #else /* !CONFIG_RT_GROUP_SCHED */ + +#ifdef CONFIG_SYSCTL static int sched_rt_global_constraints(void) { unsigned long flags; @@ -2949,8 +2953,10 @@ static int sched_rt_global_constraints(void) =20 return 0; } +#endif /* CONFIG_SYSCTL */ #endif /* CONFIG_RT_GROUP_SCHED */ =20 +#ifdef CONFIG_SYSCTL static int sched_rt_global_validate(void) { if (sysctl_sched_rt_period <=3D 0) @@ -3035,6 +3041,7 @@ static int sched_rr_handler(struct ctl_table *table, = int write, void *buffer, =20 return ret; } +#endif /* CONFIG_SYSCTL */ =20 #ifdef CONFIG_SCHED_DEBUG void print_rt_stats(struct seq_file *m, int cpu) --=20 2.25.1