Re: [PATCH v2] mm: move page-writeback sysctls to is own file

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, 29 Jan 2022 09:29:55 +0800 zhanglianjie <zhanglianjie@xxxxxxxxxxxxx> 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 <akpm@xxxxxxxxxxxxxxxxxxxx>
Subject: mm-move-page-writeback-sysctls-to-is-own-file-fix

fix CONFIG_SYSCTL=n warnings

Cc: Iurii Zaikin <yzaikin@xxxxxxxxxx>
Cc: Kees Cook <keescook@xxxxxxxxxxxx>
Cc: Luis Chamberlain <mcgrof@xxxxxxxxxx>
Cc: zhanglianjie <zhanglianjie@xxxxxxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
---

 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)
 {
_





[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux