summaryrefslogtreecommitdiff
path: root/include/linux/sysctl.h
diff options
context:
space:
mode:
authorThomas Weißschuh <linux@weissschuh.net>2024-03-22 20:05:57 +0300
committerJoel Granados <j.granados@samsung.com>2024-04-24 10:43:54 +0300
commit4a7b29f6509470a7e63dd67e516268fbef226194 (patch)
treef6373f1d592729aff778510290d68065e8160e13 /include/linux/sysctl.h
parenteb32d3adef461bc523c97321f19209f55512ee4a (diff)
downloadlinux-4a7b29f6509470a7e63dd67e516268fbef226194.tar.xz
sysctl: move sysctl type to ctl_table_header
Move the SYSCTL_TABLE_TYPE_{DEFAULT,PERMANENTLY_EMPTY} enums from ctl_table to ctl_table_header. Removing the mutable member is necessary to constify static instances of struct ctl_table. Move the initialization of the sysctl_mount_point type into init_header() where all the other header fields are also initialized. As a side-effect the memory usage of the sysctl core is reduced. Each ctl_table_header instance can manage multiple ctl_table instances and is only allocated when the table is actually registered. This saves 8 bytes of memory per ctl_table on 64bit, 4 due to the enum field itself and 4 due to padding. Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> Signed-off-by: Joel Granados <j.granados@samsung.com>
Diffstat (limited to 'include/linux/sysctl.h')
-rw-r--r--include/linux/sysctl.h22
1 files changed, 11 insertions, 11 deletions
diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h
index f9214de0490c..47bd28ffa88f 100644
--- a/include/linux/sysctl.h
+++ b/include/linux/sysctl.h
@@ -137,17 +137,6 @@ struct ctl_table {
void *data;
int maxlen;
umode_t mode;
- /**
- * enum type - Enumeration to differentiate between ctl target types
- * @SYSCTL_TABLE_TYPE_DEFAULT: ctl target with no special considerations
- * @SYSCTL_TABLE_TYPE_PERMANENTLY_EMPTY: Used to identify a permanently
- * empty directory target to serve
- * as mount point.
- */
- enum {
- SYSCTL_TABLE_TYPE_DEFAULT,
- SYSCTL_TABLE_TYPE_PERMANENTLY_EMPTY
- } type;
proc_handler *proc_handler; /* Callback for text formatting */
struct ctl_table_poll *poll;
void *extra1;
@@ -188,6 +177,17 @@ struct ctl_table_header {
struct ctl_dir *parent;
struct ctl_node *node;
struct hlist_head inodes; /* head for proc_inode->sysctl_inodes */
+ /**
+ * enum type - Enumeration to differentiate between ctl target types
+ * @SYSCTL_TABLE_TYPE_DEFAULT: ctl target with no special considerations
+ * @SYSCTL_TABLE_TYPE_PERMANENTLY_EMPTY: Used to identify a permanently
+ * empty directory target to serve
+ * as mount point.
+ */
+ enum {
+ SYSCTL_TABLE_TYPE_DEFAULT,
+ SYSCTL_TABLE_TYPE_PERMANENTLY_EMPTY,
+ } type;
};
struct ctl_dir {