From patchwork Mon May 22 19:50:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 97574 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1689307vqo; Mon, 22 May 2023 13:06:40 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6nwHGVeQ+mrYWpSKKNnnIKTSl+jGxi5TbGSTlfNDA2kWqWei3z/MQiWfgdj3AH07OA4mij X-Received: by 2002:a17:902:daca:b0:1ae:5752:aa51 with SMTP id q10-20020a170902daca00b001ae5752aa51mr14877900plx.36.1684786000560; Mon, 22 May 2023 13:06:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684786000; cv=none; d=google.com; s=arc-20160816; b=ZM6p/aCIQsw3Li5q2IJdrgR4AAXnaWFSi5xwZWjocWB5XWd/H0+LWnsqi4y8MQB3U0 wkkLanosvppI6PYQ0Ziwiw9opqxdkVLf8+qIBFU+/rmTGhxduH/uVLR1/OMdERiE5RjF aCmVtAqu0DvWqRsmE+zRFdxcI3WOEU3YyOI9G8DXC+CKIMdXuWdwP5O1vzMeRj/seT5C tmChd3JxgLUnWqlZGVE6sYEqdJRvwY7n76EinvMMuTp7QnIE7/n+9WV6r0N+Iwof1FHt YMg1riwpC/IWqsYIWtlVXyKU6y3YVKzGbUPL/BPn5DFwZFpI5eHy3UiUIxaxdZgvafcv 2keg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=EAu/Xn0qw/JXp0et7tDk90/IiF07HD9MrRXPCnBlyIs=; b=I5Thdjt0VI7BN4SjRRdZdF8R96D0/0Rgjqi3KsAyPiQBkUmtLgjePrxftMiUKmTK4a 1bLFJkmTRf2X7+ZpWbxdRYPojzR9D1X5JZlM8OXB6pglvJvx6CbS9irR+BuZaioi68jE qMhS/LezZCns4gv0tFHOlEHQGHGzE3GlIY1dge6PbIGfLBWnzABANzGwBpKg+FYCt6cW r8Aju31DrjJrG8oFNmtuHDMLIwlLMskDzZ890gBNDT917unGd+zuZp+MTrFIRe0CvxWO /uJNdw0rOuss6dInqYxMUYeNBDy6B1RvLoJJ2kImPEU4KdsgblWcpqR9Xtq9rQZ8rMr+ 8dkA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=HNu10Gzq; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c9-20020a170902724900b0019d038765f6si4910398pll.449.2023.05.22.13.06.25; Mon, 22 May 2023 13:06:40 -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=@kernel.org header.s=k20201202 header.b=HNu10Gzq; 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 S235501AbjEVTvF (ORCPT + 99 others); Mon, 22 May 2023 15:51:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45132 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235464AbjEVTu4 (ORCPT ); Mon, 22 May 2023 15:50:56 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 73ECD186 for ; Mon, 22 May 2023 12:50:48 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 2D99B62B11 for ; Mon, 22 May 2023 19:50:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 07C60C4339C; Mon, 22 May 2023 19:50:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1684785047; bh=HMrD03u6K+/VHY9xLyPNlLoBBgFtU0+LXebB+R5ntic=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HNu10GzquFi3F4cNVyQ1jrCdEeHnO6oQz6W7NEDY7Zexxuma26WWwjKScT2y5r3gM 8WsSXdHyHdKtReVJHbcwXGRWG2KdH3Pi11K4jC37/lg22XdEBuLaaGvsp/4JIHdNt4 092IEA1A311rNFqt1q15Va0jBoFf/JfpYyukqK/chrbCP44M6q57SFcUb9ptS97AKg 2dnRww6uM1CtyJlz5pXVBAlcY46/bKd44rCJ+gmdsmsiyu/IlaWRZvfUt7TptpNTux trWOOmDVhJoXtJ7DVc9Fp0BewdU2zK45qipleGrWesGm0WHUFWbI7skAi+i0CAZZoq NC5p/CLXv9pRw== From: Arnd Bergmann To: Ingo Molnar , Peter Zijlstra Cc: Arnd Bergmann , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Daniel Bristot de Oliveira , Valentin Schneider , linux-kernel@vger.kernel.org Subject: [PATCH 5/5] sched: fair: move unused stub functions to header Date: Mon, 22 May 2023 21:50:21 +0200 Message-Id: <20230522195021.3456768-6-arnd@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230522195021.3456768-1-arnd@kernel.org> References: <20230522195021.3456768-1-arnd@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1766626165321780788?= X-GMAIL-MSGID: =?utf-8?q?1766626165321780788?= From: Arnd Bergmann These four functions have a normal definition for CONFIG_FAIR_GROUP_SCHED, and empty one that is only referenced when FAIR_GROUP_SCHED is disabled but CGROUP_SCHED is still enabled. If both are turned off, the functions are still defined but the misisng prototype causes a W=1 warning: kernel/sched/fair.c:12544:6: error: no previous prototype for 'free_fair_sched_group' kernel/sched/fair.c:12546:5: error: no previous prototype for 'alloc_fair_sched_group' kernel/sched/fair.c:12553:6: error: no previous prototype for 'online_fair_sched_group' kernel/sched/fair.c:12555:6: error: no previous prototype for 'unregister_fair_sched_group' Move the alternatives into the header as static inline functions with the correct combination of #ifdef checks to avoid the warning without adding even more complexity. Signed-off-by: Arnd Bergmann Reviewed-by: Mukesh Ojha --- kernel/sched/fair.c | 13 ------------- kernel/sched/sched.h | 11 +++++++++++ 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index a7a8ccde3bd7..bae8907c1635 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -12602,19 +12602,6 @@ int sched_group_set_idle(struct task_group *tg, long idle) return 0; } -#else /* CONFIG_FAIR_GROUP_SCHED */ - -void free_fair_sched_group(struct task_group *tg) { } - -int alloc_fair_sched_group(struct task_group *tg, struct task_group *parent) -{ - return 1; -} - -void online_fair_sched_group(struct task_group *tg) { } - -void unregister_fair_sched_group(struct task_group *tg) { } - #endif /* CONFIG_FAIR_GROUP_SCHED */ diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h index d5ac0af1eede..0584fa15ffeb 100644 --- a/kernel/sched/sched.h +++ b/kernel/sched/sched.h @@ -453,10 +453,21 @@ static inline int walk_tg_tree(tg_visitor down, tg_visitor up, void *data) extern int tg_nop(struct task_group *tg, void *data); +#ifdef CONFIG_FAIR_GROUP_SCHED extern void free_fair_sched_group(struct task_group *tg); extern int alloc_fair_sched_group(struct task_group *tg, struct task_group *parent); extern void online_fair_sched_group(struct task_group *tg); extern void unregister_fair_sched_group(struct task_group *tg); +#else +static inline void free_fair_sched_group(struct task_group *tg) { } +static inline int alloc_fair_sched_group(struct task_group *tg, struct task_group *parent) +{ + return 1; +} +static inline void online_fair_sched_group(struct task_group *tg) { } +static inline void unregister_fair_sched_group(struct task_group *tg) { } +#endif + extern void init_tg_cfs_entry(struct task_group *tg, struct cfs_rq *cfs_rq, struct sched_entity *se, int cpu, struct sched_entity *parent);