diff options
author | Eric W. Biederman <ebiederm@xmission.com> | 2011-12-29 08:24:29 -0800 |
---|---|---|
committer | Eric W. Biederman <ebiederm@xmission.com> | 2012-01-24 16:40:29 -0800 |
commit | 7ec66d06362da7684a4948c4c2bf1f8546425df4 (patch) | |
tree | a16212ae2d23a46890c6d89068eaa9b2eb0f6e37 /include/linux/sysctl.h | |
parent | 9eb47c26f09e27506d343ef52e634b2a50ee21ef (diff) | |
download | op-kernel-dev-7ec66d06362da7684a4948c4c2bf1f8546425df4.zip op-kernel-dev-7ec66d06362da7684a4948c4c2bf1f8546425df4.tar.gz |
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: Eric W. Biederman <ebiederm@xmission.com>
Diffstat (limited to 'include/linux/sysctl.h')
-rw-r--r-- | include/linux/sysctl.h | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h index e73ba33..3084b62 100644 --- a/include/linux/sysctl.h +++ b/include/linux/sysctl.h @@ -938,6 +938,7 @@ struct ctl_table; struct nsproxy; struct ctl_table_root; struct ctl_table_header; +struct ctl_dir; typedef struct ctl_table ctl_table; @@ -1040,9 +1041,12 @@ struct ctl_table_header struct ctl_table *ctl_table_arg; struct ctl_table_root *root; struct ctl_table_set *set; - struct ctl_table *attached_by; - struct ctl_table *attached_to; - struct ctl_table_header *parent; + struct ctl_dir *parent; +}; + +struct ctl_dir { + /* Header must be at the start of ctl_dir */ + struct ctl_table_header header; }; struct ctl_table_set { |