Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp3223320pxb; Thu, 10 Feb 2022 15:39:44 -0800 (PST) X-Google-Smtp-Source: ABdhPJy50KLg9cCBsy63XcqaGfbpno7Jt1dUCLGhneST4NmN3Idz+ThtOZrF0HF8WYWQb87sVFx1 X-Received: by 2002:a17:902:e5cd:: with SMTP id u13mr4698044plf.40.1644536384407; Thu, 10 Feb 2022 15:39:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644536384; cv=none; d=google.com; s=arc-20160816; b=NALou3SCDtWhOYt03evhD/rvlm90eUesdx4+yLxKEfYYexgT+eR5iK20058ml2LpNh hf7L9x8ClvomcTJ1GUnQ8IaRDNC1zXbs4J1SVBNq+B3VcQyaq+8KuUX8VRt+jMajVtt0 3v8BJ4n5ZM4hScWHga7UP+8Xu9fZ/8r6DvVjsKLFFBXf/xuReYRDN3YFowa6Yuam0QzE GDbk+CO8JLvQq2AnfUjyUUHIXWLRYTM1c8vuXfxKqXR3L3bskul1wtS0fEncGhhUM0Fj AiucAbJMEKpbhuv5xRxsJjzFh077Ss1UtMjQ1pf3upXv21s+y49imf8u2ZJ8KdeQLOFC XpFQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=2Z9d73V1Hk3TZ+5A0nBSljOJ2hSUrKCy4MxgW8Jd6pE=; b=H0T1W0oZzK6hk0d9u1G157d8WVy3bMHOMAEYzUETLFCOEJ2KvOt2g3QfncvjNBSfjH Tv8z7dBhvOkNAID3L3sbal9KUUyxGP8pwp2n1e8J3Fd9G0bLkotJguktu+uWsH/lALbM BnD5F6mart397l8wQv+PU1LWspg2M49Yy55ilf3eYqKsdlUosjIIubfAjQFBCf7dUVED romFFE8Pqkc6PdfDGwqO6AiIw4USLCewY9OmnzTBwEBqp/14jbi4g+5ckaDUjnqs4F0P 1r5kVJMdW3UKn2mVhhO3mK1w9tY6DLx5DoNinGAXMgu0jYAwlo6aIQ+iNgbbXevMpncJ pz0A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=mWmITOP9; 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 c13si7857070pfr.179.2022.02.10.15.39.30; Thu, 10 Feb 2022 15:39:44 -0800 (PST) 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=@infradead.org header.s=bombadil.20210309 header.b=mWmITOP9; 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 S1344516AbiBJVFq (ORCPT + 99 others); Thu, 10 Feb 2022 16:05:46 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:38608 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238999AbiBJVFp (ORCPT ); Thu, 10 Feb 2022 16:05:45 -0500 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0139C2655; Thu, 10 Feb 2022 13:05:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=2Z9d73V1Hk3TZ+5A0nBSljOJ2hSUrKCy4MxgW8Jd6pE=; b=mWmITOP9ohmcC/iELjKVP0aY/U 0JXuv3fvinanZVg4Ju0L2+K5L1UQEAkY6Zv+zDpGUds6eL17GzEtWb0f2y2T8Q9nJmkuKxCl1dQoE SuXHE+q8GVXMOLXlDVnybMCb8U1gY9YLmjlg6yvXXRxfQojfsqgJ/qtIrQaU/0AL5rgnsZf8HY9PZ hlCRoBOvQnYhVbcQ5o2dVhbctpbANN6nv99wTnJ6Zid86d9wVF2/4/7BHluvsKaiyJpBSFMjJl6uM aLajiUxbihdXfOaqLt2W97FU/gAMfLsLulO3DUYEWO74t7fEAGWesiYDvJSritf+N7S9Mtpo27F8q LP5lWLNg==; Received: from mcgrof by bombadil.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1nIGd8-004w6Y-Hm; Thu, 10 Feb 2022 21:05:30 +0000 Date: Thu, 10 Feb 2022 13:05:30 -0800 From: Luis Chamberlain To: Zhen Ni Cc: mingo@redhat.com, peterz@infradead.org, juri.lelli@redhat.com, vincent.guittot@linaro.org, dietmar.eggemann@arm.com, rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de, bristot@redhat.com, keescook@chromium.org, yzaikin@google.com, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: Re: [PATCH v2] sched: move cfs_bandwidth_slice sysctls to fair.c Message-ID: References: <20220210054028.3062-1-nizhen@uniontech.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220210054028.3062-1-nizhen@uniontech.com> Sender: Luis Chamberlain X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_NONE,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 On Thu, Feb 10, 2022 at 01:40:28PM +0800, Zhen Ni wrote: > move cfs_bandwidth_slice sysctls to fair.c and use the > new register_sysctl_init() to register the sysctl interface. > > Signed-off-by: Zhen Ni > --- Your description of what has changed in your v2 should go here. If a v3, then your v2 notes and v3 notes should be here as well. > include/linux/sched/sysctl.h | 4 ---- > kernel/sched/fair.c | 25 +++++++++++++++++++++++-- > kernel/sysctl.c | 10 ---------- > 3 files changed, 23 insertions(+), 16 deletions(-) > > diff --git a/include/linux/sched/sysctl.h b/include/linux/sched/sysctl.h > index c19dd5a2c05c..d416d8f45186 100644 > --- a/include/linux/sched/sysctl.h > +++ b/include/linux/sched/sysctl.h > @@ -41,10 +41,6 @@ extern unsigned int sysctl_sched_uclamp_util_max; > extern unsigned int sysctl_sched_uclamp_util_min_rt_default; > #endif > > -#ifdef CONFIG_CFS_BANDWIDTH > -extern unsigned int sysctl_sched_cfs_bandwidth_slice; > -#endif > - > #ifdef CONFIG_SCHED_AUTOGROUP > extern unsigned int sysctl_sched_autogroup_enabled; > #endif > diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c > index 5146163bfabb..354ebf938567 100644 > --- a/kernel/sched/fair.c > +++ b/kernel/sched/fair.c > @@ -141,8 +141,26 @@ int __weak arch_asym_cpu_priority(int cpu) > * > * (default: 5 msec, units: microseconds) > */ > -unsigned int sysctl_sched_cfs_bandwidth_slice = 5000UL; > -#endif > +static unsigned int sysctl_sched_cfs_bandwidth_slice = 5000UL; > +#ifdef CONFIG_SYSCTL > +static struct ctl_table sched_cfs_bandwidth_sysctls[] = { > + { > + .procname = "sched_cfs_bandwidth_slice_us", > + .data = &sysctl_sched_cfs_bandwidth_slice, > + .maxlen = sizeof(unsigned int), > + .mode = 0644, > + .proc_handler = proc_dointvec_minmax, > + .extra1 = SYSCTL_ONE, > + }, > + {} > +}; > + > +static void __init sched_cfs_bandwidth_sysctl_init(void) > +{ > + register_sysctl_init("kernel", sched_cfs_bandwidth_sysctls); > +} > +#endif /* CONFIG_SYSCTL */ Maybe an #else which then adds a no-op sched_cfs_bandwidth_sysctl_init > +#endif /* CONFIG_CFS_BANDWIDTH */ Likewise, if disabled, then have a no-op sched_cfs_bandwidth_sysctl_init() > static inline void update_load_add(struct load_weight *lw, unsigned long inc) > { > @@ -207,6 +225,9 @@ static void update_sysctl(void) > void __init sched_init_granularity(void) > { > update_sysctl(); > +#if defined(CONFIG_CFS_BANDWIDTH) && defined(CONFIG_SYSCTL) > + sched_cfs_bandwidth_sysctl_init(); > +#endif Then you can get remove the #ifdef mess from this code. But this is a style issue nothing major. Luis