Re: sysfs interface to transparent hugepages

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

 



On Mon, 2011-03-21 at 13:42 +0100, Andrea Arcangeli wrote:
> On Mon, Mar 21, 2011 at 03:00:31AM +0000, Ben Hutchings wrote:
[...]
> > This, on the other hand, is totally ridiculous:
> > 
> >        if (test_bit(flag, &transparent_hugepage_flags))
> >                return sprintf(buf, "[yes] no\n");
> >        else
> >                return sprintf(buf, "yes [no]\n");
> > 
> > Why show the possible values of a boolean?  I can't even find any
> > examples of 'yes' and 'no' rather than '1' and '0'.
> 
> As said I like that format and I've been consistent in using it.

But not consistent with anything else in sysfs.

> If you write a parser for that format in userland it's probably easier to
> be consistent.

What if I already have some general functions like read_intr_attr(),
read_bool_attr(), etc.  Should I really have to write special functions
for booleans in different parts of sysfs, depending on whether the
author liked 0/1, false/true, disabled/enabled, no/yes, or
'yes [no]'/'[yes] no'?

> Anyway this got into 2.6.38 only. For other kernels
> that shipped THP before 2.6.38 there is no
> /sys/kernel/mm/transparent_hugepage directory at all (it's renamed
> exactly to avoid any risk of sysfs ABI clashes). I doubt anybody wrote
> any parser for /sys/kernel/mm/transparent_hugepage so if this is a big
> deal I suggest you send patches to whatever you prefer.

I can do that, yes.

> Or if you tell
> me exactly how you want it, I can try to implement it and if others
> agree I don't see a problem in altering it. But others may
> disagree. Clearly best would have been if you requested a change
> during 2.6.38-rc, everyone was aware of the format as everyone has
> been twiddling with these sysfs controls. Comments welcome.

Sorry, I'm a distribution maintainer and I can't be everywhere.

> > And really, why add boolean flags for a tristate at all?
> 
> I don't get the question sorry.

You have tristates {never, madvise, always} for various THM features.
Internally, these are represented as a pair of flags.  They are exposed
through sysfs as tristates, but then they are also exposed as flags.

Ben.

-- 
Ben Hutchings
Once a job is fouled up, anything done to improve it makes it worse.

Attachment: signature.asc
Description: This is a digitally signed message part


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