All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ben Hutchings <ben@decadent.org.uk>
To: Andrea Arcangeli <aarcange@redhat.com>
Cc: linux-mm@kvack.org
Subject: sysfs interface to transparent hugepages
Date: Mon, 21 Mar 2011 03:00:31 +0000	[thread overview]
Message-ID: <1300676431.26693.317.camel@localhost> (raw)

[-- 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 --]

             reply	other threads:[~2011-03-21  3:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-21  3:00 Ben Hutchings [this message]
2011-03-21 12:42 ` sysfs interface to transparent hugepages Andrea Arcangeli
2011-03-21 13:13   ` Ben Hutchings
2011-03-21 14:08     ` Andrea Arcangeli
2011-03-21 14:25       ` Ben Hutchings

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1300676431.26693.317.camel@localhost \
    --to=ben@decadent.org.uk \
    --cc=aarcange@redhat.com \
    --cc=linux-mm@kvack.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.