Commit 7ec66d06 authored by Eric W. Biederman's avatar Eric W. Biederman

sysctl: Stop requiring explicit management of sysctl directories

Simplify the code and the sysctl semantics by autogenerating
sysctl directories when a sysctl table is registered that needs
the directories and autodeleting the directories when there are
no more sysctl tables registered that need them.

Autogenerating directories keeps sysctl tables from depending
on each other, removing all of the arcane register/unregister
ordering constraints and makes it impossible to get the order
wrong when reigsering and unregistering sysctl tables.

Autogenerating directories yields one unique entity that dentries
can point to, retaining the current effective use of the dcache.

Add struct ctl_dir as the type of these new autogenerated
directories.

The attached_by and attached_to fields in ctl_table_header are
removed as they are no longer needed.

The child field in ctl_table is no longer needed by the core of
the sysctl code.  ctl_table.child can be removed once all of the
existing users have been updated.

Benchmark before:
    make-dummies 0 999 -> 0.7s
    rmmod dummy        -> 0.07s
    make-dummies 0 9999 -> 1m10s
    rmmod dummy         -> 0.4s

Benchmark after:
    make-dummies 0 999 -> 0.44s
    rmmod dummy        -> 0.065s
    make-dummies 0 9999 -> 1m36s
    rmmod dummy         -> 0.4s
Signed-off-by: default avatarEric W. Biederman <ebiederm@xmission.com>
parent 9eb47c26
This diff is collapsed.
...@@ -938,6 +938,7 @@ struct ctl_table; ...@@ -938,6 +938,7 @@ struct ctl_table;
struct nsproxy; struct nsproxy;
struct ctl_table_root; struct ctl_table_root;
struct ctl_table_header; struct ctl_table_header;
struct ctl_dir;
typedef struct ctl_table ctl_table; typedef struct ctl_table ctl_table;
...@@ -1040,9 +1041,12 @@ struct ctl_table_header ...@@ -1040,9 +1041,12 @@ struct ctl_table_header
struct ctl_table *ctl_table_arg; struct ctl_table *ctl_table_arg;
struct ctl_table_root *root; struct ctl_table_root *root;
struct ctl_table_set *set; struct ctl_table_set *set;
struct ctl_table *attached_by; struct ctl_dir *parent;
struct ctl_table *attached_to; };
struct ctl_table_header *parent;
struct ctl_dir {
/* Header must be at the start of ctl_dir */
struct ctl_table_header header;
}; };
struct ctl_table_set { struct ctl_table_set {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment