From mboxrd@z Thu Jan 1 00:00:00 1970 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id E804AC433FE for ; Mon, 31 Jan 2022 23:23:45 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5C4608D0032; Mon, 31 Jan 2022 18:23:45 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 574228D0028; Mon, 31 Jan 2022 18:23:45 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 43CC58D0032; Mon, 31 Jan 2022 18:23:45 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0073.hostedemail.com [216.40.44.73]) by kanga.kvack.org (Postfix) with ESMTP id 3283E8D0028 for ; Mon, 31 Jan 2022 18:23:45 -0500 (EST) Received: from smtpin12.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id C811C181CB2B5 for ; Mon, 31 Jan 2022 23:23:44 +0000 (UTC) X-FDA: 79092161568.12.E7E10A7 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by imf17.hostedemail.com (Postfix) with ESMTP id 3950640002 for ; Mon, 31 Jan 2022 23:23:44 +0000 (UTC) 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 ams.source.kernel.org (Postfix) with ESMTPS id A5B27B82CBC; Mon, 31 Jan 2022 23:23:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1D0BEC340E8; Mon, 31 Jan 2022 23:23:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1643671421; bh=lqSX0aoQIGN96BLzSundbxGHzVX1dMX9SwLuAAeQx6g=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=yzOivcZb1NBXcGG4WBvrbyiZDztKZxmkAVRwqz8kuA3d9PxoavglnZLUSsjFaxnhj 322Ykf0iYN5a8Zw1lk1PYzMuFugPz2L4gHRUKX2YDaVl0T2vRgZDTizZjmCJvTK2Sx dMz0IoghaJLdiRRhqENw66mbks//HIw+jWz1yE6w= Date: Mon, 31 Jan 2022 15:23:40 -0800 From: Andrew Morton To: zhanglianjie Cc: keescook@chromium.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, yzaikin@google.com, mcgrof@kernel.org Subject: Re: [PATCH v2] mm: move page-writeback sysctls to is own file Message-Id: <20220131152340.98e6bb584df772875f48f184@linux-foundation.org> In-Reply-To: <20220129012955.26594-1-zhanglianjie@uniontech.com> References: <20220129012955.26594-1-zhanglianjie@uniontech.com> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.33; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 3950640002 X-Stat-Signature: fqeduysx64jya8k3citg6gedfcebde54 Authentication-Results: imf17.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b=yzOivcZb; dmarc=none; spf=pass (imf17.hostedemail.com: domain of akpm@linux-foundation.org designates 145.40.68.75 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org X-Rspam-User: nil X-HE-Tag: 1643671424-166416 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Sat, 29 Jan 2022 09:29:55 +0800 zhanglianjie wrote: > kernel/sysctl.c is a kitchen sink where everyone leaves their dirty > dishes, this makes it very difficult to maintain. > > To help with this maintenance let's start by moving sysctls to places > where they actually belong. The proc sysctl maintainers do not want to > know what sysctl knobs you wish to add for your own piece of code, we > just care about the core logic. > > So move the page-writeback sysctls to its own file. > > ... > > --- a/mm/page-writeback.c > +++ b/mm/page-writeback.c > @@ -70,30 +70,33 @@ static long ratelimit_pages = 32; > /* > * Start background writeback (via writeback threads) at this percentage > */ > -int dirty_background_ratio = 10; > +static int dirty_background_ratio = 10; These conversions will generate warnings when CONFIG_SYSCTL=n. mm/page-writeback.c:2002:12: warning: 'dirty_writeback_centisecs_handler' defined but not used [-Wunused-function] 2002 | static int dirty_writeback_centisecs_handler(struct ctl_table *table, int write, | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ mm/page-writeback.c:545:12: warning: 'dirty_bytes_handler' defined but not used [-Wunused-function] 545 | static int dirty_bytes_handler(struct ctl_table *table, int write, | ^~~~~~~~~~~~~~~~~~~ mm/page-writeback.c:531:12: warning: 'dirty_ratio_handler' defined but not used [-Wunused-function] 531 | static int dirty_ratio_handler(struct ctl_table *table, int write, void *buffer, | ^~~~~~~~~~~~~~~~~~~ mm/page-writeback.c:520:12: warning: 'dirty_background_bytes_handler' defined but not used [-Wunused-function] 520 | static int dirty_background_bytes_handler(struct ctl_table *table, int write, | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ mm/page-writeback.c:509:12: warning: 'dirty_background_ratio_handler' defined but not used [-Wunused-function] 509 | static int dirty_background_ratio_handler(struct ctl_table *table, int write, | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ From: Andrew Morton Subject: mm-move-page-writeback-sysctls-to-is-own-file-fix fix CONFIG_SYSCTL=n warnings Cc: Iurii Zaikin Cc: Kees Cook Cc: Luis Chamberlain Cc: zhanglianjie Signed-off-by: Andrew Morton --- mm/page-writeback.c | 4 ++++ 1 file changed, 4 insertions(+) --- a/mm/page-writeback.c~mm-move-page-writeback-sysctls-to-is-own-file-fix +++ a/mm/page-writeback.c @@ -506,6 +506,7 @@ bool node_dirty_ok(struct pglist_data *p return nr_pages <= limit; } +#ifdef CONFIG_SYSCTL static int dirty_background_ratio_handler(struct ctl_table *table, int write, void *buffer, size_t *lenp, loff_t *ppos) { @@ -555,6 +556,7 @@ static int dirty_bytes_handler(struct ct } return ret; } +#endif static unsigned long wp_next_time(unsigned long cur_time) { @@ -1996,6 +1998,7 @@ bool wb_over_bg_thresh(struct bdi_writeb return false; } +#ifdef CONFIG_SYSCTL /* * sysctl handler for /proc/sys/vm/dirty_writeback_centisecs */ @@ -2020,6 +2023,7 @@ static int dirty_writeback_centisecs_han return ret; } +#endif void laptop_mode_timer_fn(struct timer_list *t) { _