Re: [PATCH 10/11] fs/drop_caches: move drop_caches sysctls to its own file

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Feb 20, 2022 at 02:06:26PM +0800, tangmeng wrote:
> diff --git a/fs/drop_caches.c b/fs/drop_caches.c
> @@ -75,3 +75,25 @@ int drop_caches_sysctl_handler(struct ctl_table *table, int write,
>  	}
>  	return 0;
>  }
> +
> +#ifdef CONFIG_SYSCTL

fs/Makefile has:
obj-$(CONFIG_SYSCTL)            += drop_caches.o

so we don't need this ifdef.

> +static struct ctl_table vm_drop_caches_table[] = {
> +	{
> +		.procname       = "drop_caches",
> +		.data           = &sysctl_drop_caches,
> +		.maxlen         = sizeof(int),
> +		.mode           = 0200,
> +		.proc_handler   = drop_caches_sysctl_handler,
> +		.extra1         = SYSCTL_ONE,
> +		.extra2         = SYSCTL_FOUR,
> +	},
> +	{ }
> +};

Something which slightly concerns me about this sysctl splitup (which
is obviously the right thing to do) is that ctl_table is quite large
(64 bytes per entry) and every array is terminated with an empty one.
In this example, we've gone from 64 bytes to 128 bytes.

Would we be better off having a register_sysctl_one() which
registers exactly one ctl_table, rather than an array?  And/or a
register_sysctl_array() which takes an ARRAY_SIZE() of its argument
instead of looking for the NULL terminator?



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux