linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* sysfs interface to transparent hugepages
@ 2011-03-21  3:00 Ben Hutchings
  2011-03-21 12:42 ` Andrea Arcangeli
  0 siblings, 1 reply; 5+ messages in thread
From: Ben Hutchings @ 2011-03-21  3:00 UTC (permalink / raw)
  To: Andrea Arcangeli; +Cc: linux-mm

[-- Attachment #1: Type: text/plain, Size: 1374 bytes --]

This kind of cute format:

       if (test_bit(enabled, &transparent_hugepage_flags)) {
               VM_BUG_ON(test_bit(req_madv, &transparent_hugepage_flags));
               return sprintf(buf, "[always] madvise never\n");
       } else if (test_bit(req_madv, &transparent_hugepage_flags))
               return sprintf(buf, "always [madvise] never\n");
       else
               return sprintf(buf, "always madvise [never]\n");

is probably nice for a kernel developer or experimental user poking
around in sysfs.  But sysfs is mostly meant for programs to read and
write, and this format is unnecessarily complex for a program to parse.

Please use separate attributes for the current value and available
values, like cpufreq does.  I know there are other examples of the above
format, but not everything already in sysfs is a *good* example!

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'.

And really, why add boolean flags for a tristate at all?

Ben.

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

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 828 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-03-21 14:25 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-21  3:00 sysfs interface to transparent hugepages Ben Hutchings
2011-03-21 12:42 ` Andrea Arcangeli
2011-03-21 13:13   ` Ben Hutchings
2011-03-21 14:08     ` Andrea Arcangeli
2011-03-21 14:25       ` Ben Hutchings

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).