Skip to content

sysctl rewrite for speed and clarity

Eric W. Biederman linux-fsdevel lkml netdev 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest29 patches 12 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/29sysctl: remove impossible condition checkfs/proc/proc_sysctl.c+2 -120 replies
1/29sysctl: remove impossible condition checkfs/proc/proc_sysctl.c+2 -120 replies
2/29sysctl: Consolidate !CONFIG_SYSCTL handlinginclude/linux/sysctl.h kernel/sysctl.c+62 -590 replies
2/29sysctl: Consolidate !CONFIG_SYSCTL handlinginclude/linux/sysctl.h kernel/sysctl.c+62 -590 replies
3/29sysctl: Register the base sysctl table like any other sysctl table.fs/proc/proc_sysctl.c include/linux/sysctl.h kernel/sysctl.c +1 more+9 -120 replies
3/29sysctl: Register the base sysctl table like any other sysctl table.fs/proc/proc_sysctl.c include/linux/sysctl.h kernel/sysctl.c +1 more+9 -120 replies
4/29sysctl: Move the implementation into fs/proc/proc_sysctl.cfs/proc/internal.h fs/proc/proc_sysctl.c include/linux/sysctl.h +3 more+625 -6410 replies
4/29sysctl: Move the implementation into fs/proc/proc_sysctl.cfs/proc/internal.h fs/proc/proc_sysctl.c include/linux/sysctl.h +3 more+625 -6410 replies
5/29sysctl: Make the directories have nlink == 1fs/proc/proc_sysctl.c+0 -10 replies
5/29sysctl: Make the directories have nlink == 1fs/proc/proc_sysctl.c+0 -10 replies
6/29sysctl: Implement retire_sysctl_setfs/proc/proc_sysctl.c include/linux/sysctl.h net/sysctl_net.c+6 -10 replies
6/29sysctl: Implement retire_sysctl_setfs/proc/proc_sysctl.c include/linux/sysctl.h net/sysctl_net.c+6 -10 replies
7/29sysctl: Remove the unnecessary sysctl_set parent concept.fs/proc/proc_sysctl.c include/linux/sysctl.h net/sysctl_net.c+10 -90 replies
7/29sysctl: Remove the unnecessary sysctl_set parent concept.fs/proc/proc_sysctl.c include/linux/sysctl.h net/sysctl_net.c+10 -90 replies
8/29sysctl: Create local copies of directory names used in pathsfs/proc/proc_sysctl.c+8 -30 replies
8/29sysctl: Create local copies of directory names used in pathsfs/proc/proc_sysctl.c+8 -30 replies
9/29sysctl: Add support for register sysctl tables with a normal cstring path.fs/proc/proc_sysctl.c include/linux/sysctl.h+87 -100 replies
9/29sysctl: Add support for register sysctl tables with a normal cstring path.fs/proc/proc_sysctl.c include/linux/sysctl.h+87 -100 replies
10/29sysctl: Add ctl_table chains into cstring pathsfs/proc/proc_sysctl.c+9 -00 replies
10/29sysctl: Add ctl_table chains into cstring pathsfs/proc/proc_sysctl.c+9 -00 replies
11/29sysctl: register only tables of sysctl filesfs/proc/proc_sysctl.c include/linux/sysctl.h+148 -190 replies
11/29sysctl: register only tables of sysctl filesfs/proc/proc_sysctl.c include/linux/sysctl.h+148 -190 replies
12/29sysctl: Improve the sysctl sanity checksfs/proc/proc_sysctl.c lib/Kconfig.debug+86 -1440 replies
12/29sysctl: Improve the sysctl sanity checksfs/proc/proc_sysctl.c lib/Kconfig.debug+86 -1440 replies
13/29sysctl: Remove the now unused ctl_table parent field.fs/proc/proc_sysctl.c include/linux/sysctl.h+1 -120 replies
13/29sysctl: Remove the now unused ctl_table parent field.fs/proc/proc_sysctl.c include/linux/sysctl.h+1 -120 replies
14/29sysctl: A more obvious version of grab_header.fs/proc/proc_sysctl.c+4 -40 replies
14/29sysctl: A more obvious version of grab_header.fs/proc/proc_sysctl.c+4 -40 replies
15/29sysctl: Initial support for auto-unregistering sysctl tables.fs/proc/proc_sysctl.c include/linux/sysctl.h+20 -90 replies
15/29sysctl: Initial support for auto-unregistering sysctl tables.fs/proc/proc_sysctl.c include/linux/sysctl.h+20 -90 replies
16/29sysctl: Factor out init_header from __register_sysctl_pathsfs/proc/proc_sysctl.c+17 -80 replies
16/29sysctl: Factor out init_header from __register_sysctl_pathsfs/proc/proc_sysctl.c+17 -80 replies
17/29sysctl: Factor out insert_header and erase_headerfs/proc/proc_sysctl.c+13 -30 replies
17/29sysctl: Factor out insert_header and erase_headerfs/proc/proc_sysctl.c+13 -30 replies
18/29sysctl: Normalize the root_table data structure.fs/proc/proc_sysctl.c+11 -40 replies
18/29sysctl: Normalize the root_table data structure.fs/proc/proc_sysctl.c+11 -42 replies
19/29sysctl: Rewrite proc_sys_lookup introducing find_entry and lookup_entry.fs/proc/proc_sysctl.c+76 -260 replies
19/29sysctl: Rewrite proc_sys_lookup introducing find_entry and lookup_entry.fs/proc/proc_sysctl.c+76 -261 reply
20/29sysctl: Rewrite proc_sys_readdir in terms of first_entry and next_entryfs/proc/proc_sysctl.c+62 -360 replies
20/29sysctl: Rewrite proc_sys_readdir in terms of first_entry and next_entryfs/proc/proc_sysctl.c+62 -360 replies
21/29sysctl: Add a root pointer to ctl_table_setfs/proc/proc_sysctl.c include/linux/sysctl.h net/sysctl_net.c+8 -30 replies
21/29sysctl: Add a root pointer to ctl_table_setfs/proc/proc_sysctl.c include/linux/sysctl.h net/sysctl_net.c+8 -31 reply
22/29sysctl: Stop requiring explicit management of sysctl directoriesfs/proc/proc_sysctl.c include/linux/sysctl.h+150 -2020 replies
22/29sysctl: Stop requiring explicit management of sysctl directoriesfs/proc/proc_sysctl.c include/linux/sysctl.h+150 -2022 replies
23/29sysctl: Add sysctl_print_dir and use it in get_subdirfs/proc/proc_sysctl.c+10 -10 replies
23/29sysctl: Add sysctl_print_dir and use it in get_subdirfs/proc/proc_sysctl.c+10 -10 replies
24/29sysctl: Replace root_list with links between sysctl_table_sets.fs/proc/proc_sysctl.c include/linux/sysctl.h+296 -1040 replies
24/29sysctl: Replace root_list with links between sysctl_table_sets.fs/proc/proc_sysctl.c include/linux/sysctl.h+296 -1045 replies
25/29sysctl: Modify __register_sysctl_paths to take a set instead of a root and an nsproxyfs/proc/proc_sysctl.c include/linux/sysctl.h net/sysctl_net.c+17 -270 replies
25/29sysctl: Modify __register_sysctl_paths to take a set instead of a root and an nsproxyfs/proc/proc_sysctl.c include/linux/sysctl.h net/sysctl_net.c+17 -270 replies
26/29sysctl: Move sysctl_check_dups into insert_headerfs/proc/proc_sysctl.c+11 -90 replies
26/29sysctl: Move sysctl_check_dups into insert_headerfs/proc/proc_sysctl.c+11 -90 replies
27/29sysctl: Make the header lists per directory.fs/proc/proc_sysctl.c include/linux/sysctl.h+12 -180 replies
27/29sysctl: Make the header lists per directory.fs/proc/proc_sysctl.c include/linux/sysctl.h+12 -180 replies
28/29sysctl: Index sysctl directories with rbtrees.fs/proc/proc_sysctl.c include/linux/sysctl.h+142 -920 replies
28/29sysctl: Index sysctl directories with rbtrees.fs/proc/proc_sysctl.c include/linux/sysctl.h+142 -920 replies
29/29sysctl: Add register_sysctl for normal sysctl usersfs/proc/proc_sysctl.c include/linux/sysctl.h+18 -00 replies
29/29sysctl: Add register_sysctl for normal sysctl usersfs/proc/proc_sysctl.c include/linux/sysctl.h+18 -00 replies

Reviews trailers per patch

2 of 58 patches have a Reviewed-by or Acked-by.

PatchJesper JuhlLucian Adrian Grijincu
1/29R-b R-b
1/29R-b R-b
2/29
2/29
3/29
3/29
4/29
4/29
5/29
5/29
6/29
6/29
7/29
7/29
8/29
8/29
9/29
9/29
10/29
10/29
11/29Inspired-by Inspired-by
11/29Inspired-by Inspired-by
12/29
12/29
13/29Inspired-by Inspired-by
13/29Inspired-by Inspired-by
14/29
14/29
15/29
15/29
16/29
16/29
17/29
17/29
18/29
18/29
19/29
19/29
20/29
20/29
21/29
21/29
22/29
22/29
23/29
23/29
24/29
24/29
25/29
25/29
26/29
26/29
27/29
27/29
28/29
28/29
29/29
29/29

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [Review][PATCH][0/29] sysctl rewrite for speed and clarity

The problem:

The current implementation of sysctl has data structures and semantics that are hard to understand, and causes sysctl to run slowly. Sysctl running slowly is a scaling problem in general and the network stack in particular.

After some heavy testing and way way too much patch rewriting I believe I have a patchset that seems sane and reasonable and gets to what looks to my weary eyes a sane result.

My patchset was heavily inspired by the previous work done by Lucian Grinjincu. Lucian kept the need for this work alive, and did a much better job than I ever though he did. Unfortunately I missed a lot of the good things Lucian did my rushed attempts at code review.

This code is also available at:
kernel.org/pub/scm/linux/kernel/git/ebiederm/sysctl.git

Eric W. Biederman (28):
sysctl: Consolidate !CONFIG_SYSCTL handling
sysctl: Register the base sysctl table like any other sysctl table.
sysctl: Move the implementation into fs/proc/proc_sysctl.c
sysctl: Make the directories have nlink == 1
sysctl: Implement retire_sysctl_set
sysctl: Remove the unnecessary sysctl_set parent concept.
sysctl: Create local copies of directory names used in paths
sysctl: Add support for register sysctl tables with a normal cstring path.
sysctl: Add ctl_table chains into cstring paths
sysctl: register only tables of sysctl files
sysctl: Improve the sysctl sanity checks
sysctl: Remove the now unused ctl_table parent field.
sysctl: A more obvious version of grab_header.
sysctl: Initial support for auto-unregistering sysctl tables.
sysctl: Factor out init_header from __register_sysctl_paths
sysctl: Factor out insert_header and erase_header
sysctl: Normalize the root_table data structure.
sysctl: Rewrite proc_sys_lookup introducing find_entry and lookup_entry.
sysctl: Rewrite proc_sys_readdir in terms of first_entry and next_entry
sysctl: Add a root pointer to ctl_table_set
sysctl: Stop requiring explicit management of sysctl directories
sysctl: Add sysctl_print_dir and use it in get_subdir
sysctl: Replace root_list with links between sysctl_table_sets.
sysctl: Modify __register_sysctl_paths to take a set instead of a root and an nsproxy
sysctl: Move sysctl_check_dups into insert_header
sysctl: Make the header lists per directory.
sysctl: Index sysctl directories with rbtrees.
sysctl: Add register_sysctl for normal sysctl users

Lucas De Marchi (1):
sysctl: remove impossible condition check

 fs/proc/internal.h     |    3 +
 fs/proc/proc_sysctl.c  | 1240 +++++++++++++++++++++++++++++++++++++++++++++---
 include/linux/sysctl.h |  106 +++--
 kernel/Makefile        |    1 -
 kernel/sysctl.c        |  501 +-------------------
 kernel/sysctl_check.c  |  160 -------
 lib/Kconfig.debug      |    8 -
 net/sysctl_net.c       |   24 +-
 8 files changed, 1247 insertions(+), 796 deletions(-)

Eric