Re: [PATCH] ksm: Expose configuration via sysctl

From: Alexander Graf
Date: Tue Feb 25 2014 - 18:09:37 EST




> Am 26.02.2014 um 01:34 schrieb Dave Hansen <dave.hansen@xxxxxxxxx>:
>
>> On 02/24/2014 03:28 PM, Alexander Graf wrote:
>> Configuration of tunables and Linux virtual memory settings has traditionally
>> happened via sysctl. Thanks to that there are well established ways to make
>> sysctl configuration bits persistent (sysctl.conf).
>>
>> KSM introduced a sysfs based configuration path which is not covered by user
>> space persistent configuration frameworks.
>>
>> In order to make life easy for sysadmins, this patch adds all access to all
>> KSM tunables via sysctl as well. That way sysctl.conf works for KSM as well,
>> giving us a streamlined way to make KSM configuration persistent.
>
> Doesn't this essentially mean "don't use sysfs for configuration"?
> Seems like at least /sys/kernel/mm/transparent_hugepage would need the
> same treatment.
>
> Couldn't we also (maybe in parallel) just teach the sysctl userspace
> about sysfs? This way we don't have to do parallel sysctls and sysfs
> for *EVERYTHING* in the kernel:
>
> sysfs.kernel.mm.transparent_hugepage.enabled=enabled

It's pretty hard to filter this. We definitely do not want to expose all of sysfs through /proc/sys. But how do we know which files are actual configuration and which ones are dynamic system introspection data?

We could add a filter, but then we can just as well stick with the manual approach I followed here :).

>
> Or do we just say "sysctls are the way to go for anything that might
> need to be persistent, don't use sysfs"?

IMHO there are 2 paths we can take:

1) Admit that using sysfs for configuration is a bad idea, use sysctl instead

2) Invent a streamlined way to set sysfs configuration variables similar to how we can set sysctl values

I'm not really sure which path is nicer. But the sitaution today is not exactly satisfactory. The most common solution to ksm configuration is an init or systemd script that sets the respective config variables.


Alex--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/