mbox series

[v3,-next,00/15] sysctl: move sysctls from vm_table into its own files

Message ID 20241010152215.3025842-1-yukaixiong@huawei.com (mailing list archive)
Headers show
Series sysctl: move sysctls from vm_table into its own files | expand

Message

yukaixiong Oct. 10, 2024, 3:22 p.m. UTC
This patch series moves sysctls of vm_table in kernel/sysctl.c to
places where they actually belong, and do some related code clean-ups.
After this patch series, all sysctls in vm_table have been moved into its
own files, meanwhile, delete vm_table.

All the modifications of this patch series base on
linux-next(tags/next-20241010). To test this patch series, the code was
compiled with both the CONFIG_SYSCTL enabled and disabled on arm64 and
x86_64 architectures. After this patch series is applied, all files
under /proc/sys/vm can be read or written normally.

Changes in v3:
 - change patch1~10, patch14 title suggested by Joel Granados
 - change sysctl_stat_interval to static type in patch1
 - add acked-by from Paul Moore in patch7
 - change dirtytime_expire_interval to static type in patch9
 - add acked-by from Anna Schumaker in patch11

Changes in v2:
 - fix sysctl_max_map_count undeclared issue in mm/nommu.c for patch6
 - update changelog for patch7/12, suggested by Kees/Paul
 - fix patch8, sorry for wrong changes and forget to built with NOMMU
 - add reviewed-by from Kees except patch8 since patch8 is wrong in v1
 - add reviewed-by from Jan Kara, Christian Brauner in patch12

Kaixiong Yu (15):
  mm: vmstat: move sysctls to mm/vmstat.c
  mm: filemap: move sysctl to mm/filemap.c
  mm: swap: move sysctl to mm/swap.c
  mm: vmscan: move vmscan sysctls to mm/vmscan.c
  mm: util: move sysctls to mm/util.c
  mm: mmap: move sysctl to mm/mmap.c
  security: min_addr: move sysctl to security/min_addr.c
  mm: nommu: move sysctl to mm/nommu.c
  fs: fs-writeback: move sysctl to fs/fs-writeback.c
  fs: drop_caches: move sysctl to fs/drop_caches.c
  sunrpc: use vfs_pressure_ratio() helper
  fs: dcache: move the sysctl to fs/dcache.c
  x86: vdso: move the sysctl to arch/x86/entry/vdso/vdso32-setup.c
  sh: vdso: move the sysctl to arch/sh/kernel/vsyscall/vsyscall.c
  sysctl: remove unneeded include

 arch/sh/kernel/vsyscall/vsyscall.c |  14 ++
 arch/x86/entry/vdso/vdso32-setup.c |  16 ++-
 fs/dcache.c                        |  21 ++-
 fs/drop_caches.c                   |  23 ++-
 fs/fs-writeback.c                  |  30 ++--
 include/linux/dcache.h             |   7 +-
 include/linux/mm.h                 |  23 ---
 include/linux/mman.h               |   2 -
 include/linux/swap.h               |   9 --
 include/linux/vmstat.h             |  11 --
 include/linux/writeback.h          |   4 -
 kernel/sysctl.c                    | 221 -----------------------------
 mm/filemap.c                       |  18 ++-
 mm/internal.h                      |  10 ++
 mm/mmap.c                          |  54 +++++++
 mm/nommu.c                         |  15 +-
 mm/swap.c                          |  16 ++-
 mm/swap.h                          |   1 +
 mm/util.c                          |  67 +++++++--
 mm/vmscan.c                        |  23 +++
 mm/vmstat.c                        |  44 +++++-
 net/sunrpc/auth.c                  |   2 +-
 security/min_addr.c                |  11 ++
 23 files changed, 330 insertions(+), 312 deletions(-)

Comments

Liam R. Howlett Oct. 11, 2024, 1:04 p.m. UTC | #1
* Kaixiong Yu <yukaixiong@huawei.com> [241010 10:11]:
> This patch series moves sysctls of vm_table in kernel/sysctl.c to
> places where they actually belong, and do some related code clean-ups.
> After this patch series, all sysctls in vm_table have been moved into its
> own files, meanwhile, delete vm_table.
> 
> All the modifications of this patch series base on
> linux-next(tags/next-20241010). To test this patch series, the code was
> compiled with both the CONFIG_SYSCTL enabled and disabled on arm64 and
> x86_64 architectures. After this patch series is applied, all files
> under /proc/sys/vm can be read or written normally.

This change set moves nommu code out of the common code into the nommu.c
file (which is nice), but the above text implies that no testing was
performed on that code.  Could we have some basic compile/boot testing
for nommu?

> 
> Changes in v3:
>  - change patch1~10, patch14 title suggested by Joel Granados
>  - change sysctl_stat_interval to static type in patch1
>  - add acked-by from Paul Moore in patch7
>  - change dirtytime_expire_interval to static type in patch9
>  - add acked-by from Anna Schumaker in patch11
> 
> Changes in v2:
>  - fix sysctl_max_map_count undeclared issue in mm/nommu.c for patch6
>  - update changelog for patch7/12, suggested by Kees/Paul
>  - fix patch8, sorry for wrong changes and forget to built with NOMMU
>  - add reviewed-by from Kees except patch8 since patch8 is wrong in v1
>  - add reviewed-by from Jan Kara, Christian Brauner in patch12
> 
> Kaixiong Yu (15):
>   mm: vmstat: move sysctls to mm/vmstat.c
>   mm: filemap: move sysctl to mm/filemap.c
>   mm: swap: move sysctl to mm/swap.c
>   mm: vmscan: move vmscan sysctls to mm/vmscan.c
>   mm: util: move sysctls to mm/util.c
>   mm: mmap: move sysctl to mm/mmap.c
>   security: min_addr: move sysctl to security/min_addr.c
>   mm: nommu: move sysctl to mm/nommu.c
>   fs: fs-writeback: move sysctl to fs/fs-writeback.c
>   fs: drop_caches: move sysctl to fs/drop_caches.c
>   sunrpc: use vfs_pressure_ratio() helper
>   fs: dcache: move the sysctl to fs/dcache.c
>   x86: vdso: move the sysctl to arch/x86/entry/vdso/vdso32-setup.c
>   sh: vdso: move the sysctl to arch/sh/kernel/vsyscall/vsyscall.c
>   sysctl: remove unneeded include
> 
>  arch/sh/kernel/vsyscall/vsyscall.c |  14 ++
>  arch/x86/entry/vdso/vdso32-setup.c |  16 ++-
>  fs/dcache.c                        |  21 ++-
>  fs/drop_caches.c                   |  23 ++-
>  fs/fs-writeback.c                  |  30 ++--
>  include/linux/dcache.h             |   7 +-
>  include/linux/mm.h                 |  23 ---
>  include/linux/mman.h               |   2 -
>  include/linux/swap.h               |   9 --
>  include/linux/vmstat.h             |  11 --
>  include/linux/writeback.h          |   4 -
>  kernel/sysctl.c                    | 221 -----------------------------
>  mm/filemap.c                       |  18 ++-
>  mm/internal.h                      |  10 ++
>  mm/mmap.c                          |  54 +++++++
>  mm/nommu.c                         |  15 +-
>  mm/swap.c                          |  16 ++-
>  mm/swap.h                          |   1 +
>  mm/util.c                          |  67 +++++++--
>  mm/vmscan.c                        |  23 +++
>  mm/vmstat.c                        |  44 +++++-
>  net/sunrpc/auth.c                  |   2 +-
>  security/min_addr.c                |  11 ++
>  23 files changed, 330 insertions(+), 312 deletions(-)
> 
> -- 
> 2.34.1
>
yukaixiong Oct. 14, 2024, 1:33 a.m. UTC | #2
On 2024/10/11 21:04, Liam R. Howlett wrote:
> * Kaixiong Yu <yukaixiong@huawei.com> [241010 10:11]:
>> This patch series moves sysctls of vm_table in kernel/sysctl.c to
>> places where they actually belong, and do some related code clean-ups.
>> After this patch series, all sysctls in vm_table have been moved into its
>> own files, meanwhile, delete vm_table.
>>
>> All the modifications of this patch series base on
>> linux-next(tags/next-20241010). To test this patch series, the code was
>> compiled with both the CONFIG_SYSCTL enabled and disabled on arm64 and
>> x86_64 architectures. After this patch series is applied, all files
>> under /proc/sys/vm can be read or written normally.
> This change set moves nommu code out of the common code into the nommu.c
> file (which is nice), but the above text implies that no testing was
> performed on that code.  Could we have some basic compile/boot testing
> for nommu?
this patch series has been compiled with CONFIG_MMU=n on arm,and produce
nommu.o without error and warning. But I don't have machine to do test 
for nommu.
>> Changes in v3:
>>   - change patch1~10, patch14 title suggested by Joel Granados
>>   - change sysctl_stat_interval to static type in patch1
>>   - add acked-by from Paul Moore in patch7
>>   - change dirtytime_expire_interval to static type in patch9
>>   - add acked-by from Anna Schumaker in patch11
>>
>> Changes in v2:
>>   - fix sysctl_max_map_count undeclared issue in mm/nommu.c for patch6
>>   - update changelog for patch7/12, suggested by Kees/Paul
>>   - fix patch8, sorry for wrong changes and forget to built with NOMMU
>>   - add reviewed-by from Kees except patch8 since patch8 is wrong in v1
>>   - add reviewed-by from Jan Kara, Christian Brauner in patch12
>>
>> Kaixiong Yu (15):
>>    mm: vmstat: move sysctls to mm/vmstat.c
>>    mm: filemap: move sysctl to mm/filemap.c
>>    mm: swap: move sysctl to mm/swap.c
>>    mm: vmscan: move vmscan sysctls to mm/vmscan.c
>>    mm: util: move sysctls to mm/util.c
>>    mm: mmap: move sysctl to mm/mmap.c
>>    security: min_addr: move sysctl to security/min_addr.c
>>    mm: nommu: move sysctl to mm/nommu.c
>>    fs: fs-writeback: move sysctl to fs/fs-writeback.c
>>    fs: drop_caches: move sysctl to fs/drop_caches.c
>>    sunrpc: use vfs_pressure_ratio() helper
>>    fs: dcache: move the sysctl to fs/dcache.c
>>    x86: vdso: move the sysctl to arch/x86/entry/vdso/vdso32-setup.c
>>    sh: vdso: move the sysctl to arch/sh/kernel/vsyscall/vsyscall.c
>>    sysctl: remove unneeded include
>>
>>   arch/sh/kernel/vsyscall/vsyscall.c |  14 ++
>>   arch/x86/entry/vdso/vdso32-setup.c |  16 ++-
>>   fs/dcache.c                        |  21 ++-
>>   fs/drop_caches.c                   |  23 ++-
>>   fs/fs-writeback.c                  |  30 ++--
>>   include/linux/dcache.h             |   7 +-
>>   include/linux/mm.h                 |  23 ---
>>   include/linux/mman.h               |   2 -
>>   include/linux/swap.h               |   9 --
>>   include/linux/vmstat.h             |  11 --
>>   include/linux/writeback.h          |   4 -
>>   kernel/sysctl.c                    | 221 -----------------------------
>>   mm/filemap.c                       |  18 ++-
>>   mm/internal.h                      |  10 ++
>>   mm/mmap.c                          |  54 +++++++
>>   mm/nommu.c                         |  15 +-
>>   mm/swap.c                          |  16 ++-
>>   mm/swap.h                          |   1 +
>>   mm/util.c                          |  67 +++++++--
>>   mm/vmscan.c                        |  23 +++
>>   mm/vmstat.c                        |  44 +++++-
>>   net/sunrpc/auth.c                  |   2 +-
>>   security/min_addr.c                |  11 ++
>>   23 files changed, 330 insertions(+), 312 deletions(-)
>>
>> -- 
>> 2.34.1
>>
> .
>
Joel Granados Oct. 21, 2024, 7:22 a.m. UTC | #3
On Thu, Oct 10, 2024 at 11:22:00PM +0800, Kaixiong Yu wrote:
> This patch series moves sysctls of vm_table in kernel/sysctl.c to
> places where they actually belong, and do some related code clean-ups.
> After this patch series, all sysctls in vm_table have been moved into its
> own files, meanwhile, delete vm_table.
> 
> All the modifications of this patch series base on
> linux-next(tags/next-20241010). To test this patch series, the code was
> compiled with both the CONFIG_SYSCTL enabled and disabled on arm64 and
> x86_64 architectures. After this patch series is applied, all files
> under /proc/sys/vm can be read or written normally.
> 
> Changes in v3:
>  - change patch1~10, patch14 title suggested by Joel Granados
>  - change sysctl_stat_interval to static type in patch1
>  - add acked-by from Paul Moore in patch7
>  - change dirtytime_expire_interval to static type in patch9
>  - add acked-by from Anna Schumaker in patch11
> 
> Changes in v2:
>  - fix sysctl_max_map_count undeclared issue in mm/nommu.c for patch6
>  - update changelog for patch7/12, suggested by Kees/Paul
>  - fix patch8, sorry for wrong changes and forget to built with NOMMU
>  - add reviewed-by from Kees except patch8 since patch8 is wrong in v1
>  - add reviewed-by from Jan Kara, Christian Brauner in patch12
> 
> Kaixiong Yu (15):
>   mm: vmstat: move sysctls to mm/vmstat.c
>   mm: filemap: move sysctl to mm/filemap.c
>   mm: swap: move sysctl to mm/swap.c
>   mm: vmscan: move vmscan sysctls to mm/vmscan.c
>   mm: util: move sysctls to mm/util.c
>   mm: mmap: move sysctl to mm/mmap.c
>   security: min_addr: move sysctl to security/min_addr.c
>   mm: nommu: move sysctl to mm/nommu.c
>   fs: fs-writeback: move sysctl to fs/fs-writeback.c
>   fs: drop_caches: move sysctl to fs/drop_caches.c
>   sunrpc: use vfs_pressure_ratio() helper
>   fs: dcache: move the sysctl to fs/dcache.c
>   x86: vdso: move the sysctl to arch/x86/entry/vdso/vdso32-setup.c
>   sh: vdso: move the sysctl to arch/sh/kernel/vsyscall/vsyscall.c
>   sysctl: remove unneeded include
> 
>  arch/sh/kernel/vsyscall/vsyscall.c |  14 ++
>  arch/x86/entry/vdso/vdso32-setup.c |  16 ++-
>  fs/dcache.c                        |  21 ++-
>  fs/drop_caches.c                   |  23 ++-
>  fs/fs-writeback.c                  |  30 ++--
>  include/linux/dcache.h             |   7 +-
>  include/linux/mm.h                 |  23 ---
>  include/linux/mman.h               |   2 -
>  include/linux/swap.h               |   9 --
>  include/linux/vmstat.h             |  11 --
>  include/linux/writeback.h          |   4 -
>  kernel/sysctl.c                    | 221 -----------------------------
>  mm/filemap.c                       |  18 ++-
>  mm/internal.h                      |  10 ++
>  mm/mmap.c                          |  54 +++++++
>  mm/nommu.c                         |  15 +-
>  mm/swap.c                          |  16 ++-
>  mm/swap.h                          |   1 +
>  mm/util.c                          |  67 +++++++--
>  mm/vmscan.c                        |  23 +++
>  mm/vmstat.c                        |  44 +++++-
>  net/sunrpc/auth.c                  |   2 +-
>  security/min_addr.c                |  11 ++
>  23 files changed, 330 insertions(+), 312 deletions(-)
> 
> -- 
> 2.34.1
> 
General comment for the patchset in general. I would consider making the
new sysctl tables const. There is an effort for doing this and it has
already lanted in linux-next. So if you base your patch from a recent
next release, then it should just work. If you *do* decide to add a
const qualifier, then note that you will create a dependency with the
sysctl patchset currently in next and that will have to go in before.

Best
yukaixiong Oct. 24, 2024, 8:07 a.m. UTC | #4
On 2024/10/21 15:22, Joel Granados wrote:
> On Thu, Oct 10, 2024 at 11:22:00PM +0800, Kaixiong Yu wrote:
>> This patch series moves sysctls of vm_table in kernel/sysctl.c to
>> places where they actually belong, and do some related code clean-ups.
>> After this patch series, all sysctls in vm_table have been moved into its
>> own files, meanwhile, delete vm_table.
>>
>> All the modifications of this patch series base on
>> linux-next(tags/next-20241010). To test this patch series, the code was
>> compiled with both the CONFIG_SYSCTL enabled and disabled on arm64 and
>> x86_64 architectures. After this patch series is applied, all files
>> under /proc/sys/vm can be read or written normally.
>>
>> Changes in v3:
>>   - change patch1~10, patch14 title suggested by Joel Granados
>>   - change sysctl_stat_interval to static type in patch1
>>   - add acked-by from Paul Moore in patch7
>>   - change dirtytime_expire_interval to static type in patch9
>>   - add acked-by from Anna Schumaker in patch11
>>
>> Changes in v2:
>>   - fix sysctl_max_map_count undeclared issue in mm/nommu.c for patch6
>>   - update changelog for patch7/12, suggested by Kees/Paul
>>   - fix patch8, sorry for wrong changes and forget to built with NOMMU
>>   - add reviewed-by from Kees except patch8 since patch8 is wrong in v1
>>   - add reviewed-by from Jan Kara, Christian Brauner in patch12
>>
>> Kaixiong Yu (15):
>>    mm: vmstat: move sysctls to mm/vmstat.c
>>    mm: filemap: move sysctl to mm/filemap.c
>>    mm: swap: move sysctl to mm/swap.c
>>    mm: vmscan: move vmscan sysctls to mm/vmscan.c
>>    mm: util: move sysctls to mm/util.c
>>    mm: mmap: move sysctl to mm/mmap.c
>>    security: min_addr: move sysctl to security/min_addr.c
>>    mm: nommu: move sysctl to mm/nommu.c
>>    fs: fs-writeback: move sysctl to fs/fs-writeback.c
>>    fs: drop_caches: move sysctl to fs/drop_caches.c
>>    sunrpc: use vfs_pressure_ratio() helper
>>    fs: dcache: move the sysctl to fs/dcache.c
>>    x86: vdso: move the sysctl to arch/x86/entry/vdso/vdso32-setup.c
>>    sh: vdso: move the sysctl to arch/sh/kernel/vsyscall/vsyscall.c
>>    sysctl: remove unneeded include
>>
>>   arch/sh/kernel/vsyscall/vsyscall.c |  14 ++
>>   arch/x86/entry/vdso/vdso32-setup.c |  16 ++-
>>   fs/dcache.c                        |  21 ++-
>>   fs/drop_caches.c                   |  23 ++-
>>   fs/fs-writeback.c                  |  30 ++--
>>   include/linux/dcache.h             |   7 +-
>>   include/linux/mm.h                 |  23 ---
>>   include/linux/mman.h               |   2 -
>>   include/linux/swap.h               |   9 --
>>   include/linux/vmstat.h             |  11 --
>>   include/linux/writeback.h          |   4 -
>>   kernel/sysctl.c                    | 221 -----------------------------
>>   mm/filemap.c                       |  18 ++-
>>   mm/internal.h                      |  10 ++
>>   mm/mmap.c                          |  54 +++++++
>>   mm/nommu.c                         |  15 +-
>>   mm/swap.c                          |  16 ++-
>>   mm/swap.h                          |   1 +
>>   mm/util.c                          |  67 +++++++--
>>   mm/vmscan.c                        |  23 +++
>>   mm/vmstat.c                        |  44 +++++-
>>   net/sunrpc/auth.c                  |   2 +-
>>   security/min_addr.c                |  11 ++
>>   23 files changed, 330 insertions(+), 312 deletions(-)
>>
>> -- 
>> 2.34.1
>>
> General comment for the patchset in general. I would consider making the
> new sysctl tables const. There is an effort for doing this and it has
> already lanted in linux-next. So if you base your patch from a recent
> next release, then it should just work. If you *do* decide to add a
> const qualifier, then note that you will create a dependency with the
> sysctl patchset currently in next and that will have to go in before.
>
> Best
>

Sorry,  I don't understand what is the meaning of "create a dependency 
with the sysctl patchset".

Do you just want me to change all "static struct ctl_table" type table 
into "static const struct ctl_table" type in my patchset?
Joel Granados Oct. 24, 2024, 8:59 a.m. UTC | #5
On Thu, Oct 24, 2024 at 04:07:10PM +0800, yukaixiong wrote:
...
> 
> 
> >>   mm/swap.c                          |  16 ++-
> >>   mm/swap.h                          |   1 +
> >>   mm/util.c                          |  67 +++++++--
> >>   mm/vmscan.c                        |  23 +++
> >>   mm/vmstat.c                        |  44 +++++-
> >>   net/sunrpc/auth.c                  |   2 +-
> >>   security/min_addr.c                |  11 ++
> >>   23 files changed, 330 insertions(+), 312 deletions(-)
> >>
> >> -- 
> >> 2.34.1
> >>
> > General comment for the patchset in general. I would consider making the
> > new sysctl tables const. There is an effort for doing this and it has
> > already lanted in linux-next. So if you base your patch from a recent
> > next release, then it should just work. If you *do* decide to add a
> > const qualifier, then note that you will create a dependency with the
> > sysctl patchset currently in next and that will have to go in before.
> >
> > Best
> >
> 
> Sorry,  I don't understand what is the meaning of "create a dependency 
> with the sysctl patchset".
The patches in the sysctl subsys that allow you to qualify the ctl_table
as const are not in mainline yet. They are in linux-next. This means
that if these patches go into the next kernel release before the
sysctl-next branch, it will have compilation errors. Therefore the
sysctl-next branch needs to be pulled in to the new kernel release
before this patchest. This also means that for this to build properly it
has to be based on a linux-next release.

> 
> Do you just want me to change all "static struct ctl_table" type table 
> into "static const struct ctl_table" type in my patchset?
You should const qualify them if the maintainer that is pulling in these
patches is ok with it. You should *not* const qualify them if the
maintainer prefers otherwise.

Please get back to me if I did not address your questions.

Best