On Mon 16-03-20 15:53:21, Vlastimil Babka wrote: > On 3/12/20 2:26 PM, Michal Hocko wrote: > > On Thu 12-03-20 12:54:19, Ivan Teterevkov wrote: > >> > >> Absolutely agree, the semantics of the vm_swappiness is perplexing. > >> Moreover, the same get_scan_count treats vm_swappiness and cgroups > >> memory.swappiness differently, in particular, 0 disables the memcg swap. > >> > >> Certainly, the patch adds some additional exposure to a parameter that > >> is not trivial to tackle but it's already getting created with a magic > >> number which is also confusing. Is there any harm to be done by the patch > >> considering the already existing sysctl interface to that knob? > > > > Like any other config option/kernel parameter. It is adding the the > > overall config space size problem and unless this is really needed I > > would rather not make it worse. > > Setting the vm_swappiness specific case aside, I wonder if if would be > useful to be able to emulate any sysctl with a kernel parameter, > i.e. boot the kernel with sysctl.vm.swappiness=X > There are already some options that provide kernel parameter as well > as sysctl, why not just support all. This sounds like a much better idea than a case by case handling. I wouldn't be surprised if some kernel parameters would duplicate sysctl values. I cannot judge the implementation unfortunately but from a quick glance it makes sense to me. Especially where you hooked it into because not all handlers are simple setters for a global value. Some of them have a much more complicated logic which requires a lot of infrastructure to be set up already. So putting do_sysctl_args right before the init is executed should be good enough. Care to post an RFC to a larger audience? Let's see where we get from there. > Quick and dirty proof of concept: > @@ -1367,6 +1384,8 @@ static int __ref kernel_init(void *unused) > > rcu_end_inkernel_boot(); > > + do_sysctl_args(); > + > if (ramdisk_execute_command) { > ret = run_init_process(ramdisk_execute_command); > if (!ret) -- Michal Hocko SUSE Labs