Re: Sysfs one-value-per-file (was Re: [PATCH] vmstat: don't auto expand the sysfs files)

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

 



On Thu, 28 Dec 2023, Greg Kroah-Hartman wrote:

> > I'd argue that the ship on the "sysfs one-value-per-file rule" has sailed 
> > for long-standing use cases where either (1) switching is just not 
> > possible or (2) switching would be an undue burden to the user.
> > 
> > An example of (1) would be THP enablement and defrag options:
> > 
> > $ grep . /sys/kernel/mm/transparent_hugepage/{defrag,enabled,shmem_enabled}
> > /sys/kernel/mm/transparent_hugepage/defrag:always defer defer+madvise [madvise] never
> > /sys/kernel/mm/transparent_hugepage/enabled:[always] madvise never
> > /sys/kernel/mm/transparent_hugepage/shmem_enabled:always within_size advise [never] deny force
> > 
> > This convention isn't going to change.  We're not going to suddenly add a 
> > new enablement or defrag option that can only be set in a newly added 
> > file that is one-value-per-file.
> > 
> > THP was obviously introduced before any sysfs "one-value-per-file rule" 
> 
> No, the rule has been there since "day one" for sysfs, this file snuck
> in much later with no one noticing it against the "rules" and I've been
> complaining about it every time someone tries to add a new field to it
> that I notice.
> 

Ah, gotcha, thanks.  I had assumed that the push for one-value-per-file 
started after thp, and perhaps even because of thp :)  I have to admit 
that whenever I log into a new server type one of the first things I do is

$ cat /sys/devices/system/node/node*/distance

and that table just makes intuitive sense.  If we were to go back in time 
and reimplement that as one-value-per-file, I'd just assume that many 
userspace implementations would just need to read 64 different files to 
structure it into the same exact table.

On the other hand, I have wished countless times that the thp settings 
would have actually been one-value-per-file from the start.




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux