[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20080212192836.a8500902.pj@sgi.com>
Date: Tue, 12 Feb 2008 19:28:36 -0600
From: Paul Jackson <pj@....com>
To: Christoph Lameter <clameter@....com>
Cc: Lee.Schermerhorn@...com, rientjes@...gle.com,
akpm@...ux-foundation.org, ak@...e.de, linux-kernel@...r.kernel.org
Subject: Re: [patch 1/4] mempolicy: convert MPOL constants to enum
Christoph wrote:
> We usually do that with unsigned XXX and constants. You may want to check
> multiple flags at once or do other fancy things.
Both are common in the kernel. I see 241 ":1" bit fields in include/linux/*.h.
One can do Boolean expressions with either form, bitfields or defines.
For example:
struct {
int foo:1;
int goo:1;
} x;
if (x.foo && ! x.goo)
blah blah ...;
Doing (x.flags & FLAG_FOO) is simple enough, but it is still
not as simple as (x.foo). Where possible, I encourage keeping
extraneous detail out of mainline code.
Sometimes, such as in task struct flags, one has to do such Boolean
combinations in performance critical code paths, and then one must do
what one must do, with the defined constants.
Sometimes, such as with the GFP_* flags, one has to name various
combinations, and then one needs again to use defined constants.
I see no evidence that either of those situations applies here.
--
I won't rest till it's the best ...
Programmer, Linux Scalability
Paul Jackson <pj@....com> 1.940.382.4214
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists