Re: [patch 1/4] mempolicy: convert MPOL constants to enum

2008-02-12 Thread Paul Jackson
David wrote: > That doesn't logically follow because the aggregate of the mode and the > optional flags _are_ the policy itself. I give up ... I still don't agree, but that's ok. -- I won't rest till it's the best ... Programmer, Linux Scalability

Re: [patch 1/4] mempolicy: convert MPOL constants to enum

2008-02-12 Thread David Rientjes
On Tue, 12 Feb 2008, Paul Jackson wrote: > ==> If each time I look at some 'flags' field, I have to think of it > as a couple of things glued together that I will have to pick apart to > use, that's more mental work than seeing those two things explicit and > separate, through most of the

Re: [patch 1/4] mempolicy: convert MPOL constants to enum

2008-02-12 Thread Paul Jackson
> I do not subscribe to the theory that just because we have a couple extra > bytes of space somewhere in struct mempolicy that we have to use it > immediately. Good grief ... I'm not lobbying for separate flag fields because the space is there. I was just dealing with one possible obection,

Re: [patch 1/4] mempolicy: convert MPOL constants to enum

2008-02-12 Thread David Rientjes
On Tue, 12 Feb 2008, Paul Jackson wrote: > However, once inside the kernel, how we store this flag in struct mempolicy, > and how we pass it about between kernel routines, is our choice. > > We can leave it packed, and unpack and repack it each time we consider the > flag and mode bits, or we

Re: [patch 1/4] mempolicy: convert MPOL constants to enum

2008-02-12 Thread Paul Jackson
David wrote: > The enum has already been removed, as I've said a few times. Yup. Sorry ... beating dead horses is too much fun. > The 'flags' field would be wrong because you're ignoring that these flags > are both passed by the user to the kernel and by the kernel to the user as > part of

Re: [patch 1/4] mempolicy: convert MPOL constants to enum

2008-02-12 Thread David Rientjes
On Tue, 12 Feb 2008, Paul Jackson wrote: > Christoph wrote: > > Good. And remove the enum. > > > > It would be better to add some sort of flags field? > > On the other hand, despite my brilliant (hah!) endorsement > of bit field flags in my reply a few minutes ago, I'd settle > for (1) removing

Re: [patch 1/4] mempolicy: convert MPOL constants to enum

2008-02-12 Thread Paul Jackson
Christoph wrote: > Good. And remove the enum. > > It would be better to add some sort of flags field? On the other hand, despite my brilliant (hah!) endorsement of bit field flags in my reply a few minutes ago, I'd settle for (1) removing the enum, and (2) using a flags field and more defines

Re: [patch 1/4] mempolicy: convert MPOL constants to enum

2008-02-12 Thread Paul Jackson
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.

Re: [patch 1/4] mempolicy: convert MPOL constants to enum

2008-02-12 Thread Christoph Lameter
On Tue, 12 Feb 2008, Paul Jackson wrote: > I'm inclined toward the original types for the 'policy' field. Good. And remove the enum. > Specifically, I'd suggest adding the one line for 'mode_f_static_nodes' > as below, and leaving the code involving the encoding of the policy > field alone. >

Re: [patch 1/4] mempolicy: convert MPOL constants to enum

2008-02-12 Thread David Rientjes
On Tue, 12 Feb 2008, Paul Jackson wrote: > I tend to agree with Lee on this one. If I recall correctly, Christoph > said something similar, regarding the change of the 'policy' field > of struct mempolicy from a short to an enum. > I've already made the change in my patchset as a result of

Re: [patch 1/4] mempolicy: convert MPOL constants to enum

2008-02-12 Thread Paul Jackson
Lee wrote: > Why not leave it as an int. Will simplify this and subsequent patch. I tend to agree with Lee on this one. If I recall correctly, Christoph said something similar, regarding the change of the 'policy' field of struct mempolicy from a short to an enum. I'm inclined toward the

Re: [patch 1/4] mempolicy: convert MPOL constants to enum

2008-02-12 Thread Lee Schermerhorn
On Mon, 2008-02-11 at 07:30 -0800, David Rientjes wrote: > The mempolicy mode constants, MPOL_DEFAULT, MPOL_PREFERRED, MPOL_BIND, > and MPOL_INTERLEAVE, are better declared as part of an enum for type > checking. > > The policy member of struct mempolicy is also converted from type short > to

Re: [patch 1/4] mempolicy: convert MPOL constants to enum

2008-02-12 Thread Lee Schermerhorn
On Mon, 2008-02-11 at 07:30 -0800, David Rientjes wrote: The mempolicy mode constants, MPOL_DEFAULT, MPOL_PREFERRED, MPOL_BIND, and MPOL_INTERLEAVE, are better declared as part of an enum for type checking. The policy member of struct mempolicy is also converted from type short to type

Re: [patch 1/4] mempolicy: convert MPOL constants to enum

2008-02-12 Thread Paul Jackson
David wrote: That doesn't logically follow because the aggregate of the mode and the optional flags _are_ the policy itself. I give up ... I still don't agree, but that's ok. -- I won't rest till it's the best ... Programmer, Linux Scalability

Re: [patch 1/4] mempolicy: convert MPOL constants to enum

2008-02-12 Thread David Rientjes
On Tue, 12 Feb 2008, Paul Jackson wrote: == If each time I look at some 'flags' field, I have to think of it as a couple of things glued together that I will have to pick apart to use, that's more mental work than seeing those two things explicit and separate, through most of the mempolicy.c

Re: [patch 1/4] mempolicy: convert MPOL constants to enum

2008-02-12 Thread Paul Jackson
I do not subscribe to the theory that just because we have a couple extra bytes of space somewhere in struct mempolicy that we have to use it immediately. Good grief ... I'm not lobbying for separate flag fields because the space is there. I was just dealing with one possible obection, by

Re: [patch 1/4] mempolicy: convert MPOL constants to enum

2008-02-12 Thread David Rientjes
On Tue, 12 Feb 2008, Paul Jackson wrote: However, once inside the kernel, how we store this flag in struct mempolicy, and how we pass it about between kernel routines, is our choice. We can leave it packed, and unpack and repack it each time we consider the flag and mode bits, or we can

Re: [patch 1/4] mempolicy: convert MPOL constants to enum

2008-02-12 Thread Paul Jackson
Christoph wrote: Good. And remove the enum. It would be better to add some sort of flags field? On the other hand, despite my brilliant (hah!) endorsement of bit field flags in my reply a few minutes ago, I'd settle for (1) removing the enum, and (2) using a flags field and more defines for

Re: [patch 1/4] mempolicy: convert MPOL constants to enum

2008-02-12 Thread Paul Jackson
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

Re: [patch 1/4] mempolicy: convert MPOL constants to enum

2008-02-12 Thread Paul Jackson
David wrote: The enum has already been removed, as I've said a few times. Yup. Sorry ... beating dead horses is too much fun. The 'flags' field would be wrong because you're ignoring that these flags are both passed by the user to the kernel and by the kernel to the user as part of the

Re: [patch 1/4] mempolicy: convert MPOL constants to enum

2008-02-12 Thread David Rientjes
On Tue, 12 Feb 2008, Paul Jackson wrote: I tend to agree with Lee on this one. If I recall correctly, Christoph said something similar, regarding the change of the 'policy' field of struct mempolicy from a short to an enum. I've already made the change in my patchset as a result of

Re: [patch 1/4] mempolicy: convert MPOL constants to enum

2008-02-12 Thread Paul Jackson
Lee wrote: Why not leave it as an int. Will simplify this and subsequent patch. I tend to agree with Lee on this one. If I recall correctly, Christoph said something similar, regarding the change of the 'policy' field of struct mempolicy from a short to an enum. I'm inclined toward the

Re: [patch 1/4] mempolicy: convert MPOL constants to enum

2008-02-12 Thread Christoph Lameter
On Tue, 12 Feb 2008, Paul Jackson wrote: I'm inclined toward the original types for the 'policy' field. Good. And remove the enum. Specifically, I'd suggest adding the one line for 'mode_f_static_nodes' as below, and leaving the code involving the encoding of the policy field alone.

Re: [patch 1/4] mempolicy: convert MPOL constants to enum

2008-02-12 Thread David Rientjes
On Tue, 12 Feb 2008, Paul Jackson wrote: Christoph wrote: Good. And remove the enum. It would be better to add some sort of flags field? On the other hand, despite my brilliant (hah!) endorsement of bit field flags in my reply a few minutes ago, I'd settle for (1) removing the enum,

Re: [patch 1/4] mempolicy: convert MPOL constants to enum

2008-02-11 Thread Christoph Lameter
On Mon, 11 Feb 2008, David Rientjes wrote: > On Mon, 11 Feb 2008, Christoph Lameter wrote: > > > Then you could follow through with the enum mempolicy thing > > throughtout. Why not use enum mempolicy in struct mempolicy? > > > > Mempolicy flags, as I implemented them in patch 2 in this

Re: [patch 1/4] mempolicy: convert MPOL constants to enum

2008-02-11 Thread David Rientjes
On Mon, 11 Feb 2008, Christoph Lameter wrote: > Then you could follow through with the enum mempolicy thing > throughtout. Why not use enum mempolicy in struct mempolicy? > Mempolicy flags, as I implemented them in patch 2 in this series, are not integer constants that are enumerated starting

Re: [patch 1/4] mempolicy: convert MPOL constants to enum

2008-02-11 Thread Christoph Lameter
On Mon, 11 Feb 2008, David Rientjes wrote: > > The second paragraphs seems to indicate that such an approach does not > > work since we also use MPOL_xx constants to set flags in the memory > > policies? > > > > Not sure I'm understanding your question, sorry. > > Mempolicy modes have always

Re: [patch 1/4] mempolicy: convert MPOL constants to enum

2008-02-11 Thread David Rientjes
On Mon, 11 Feb 2008, Christoph Lameter wrote: > > The policy member of struct mempolicy is also converted from type short > > to type unsigned short. A negative policy does not have any legitimate > > meaning, so it is possible to change its type in preparation for adding > > optional mode flags

Re: [patch 1/4] mempolicy: convert MPOL constants to enum

2008-02-11 Thread Christoph Lameter
On Mon, 11 Feb 2008, David Rientjes wrote: > The mempolicy mode constants, MPOL_DEFAULT, MPOL_PREFERRED, MPOL_BIND, > and MPOL_INTERLEAVE, are better declared as part of an enum for type > checking. > > The policy member of struct mempolicy is also converted from type short > to type unsigned

Re: [patch 1/4] mempolicy: convert MPOL constants to enum

2008-02-11 Thread David Rientjes
On Mon, 11 Feb 2008, Andi Kleen wrote: > > The mempolicy mode constants, MPOL_DEFAULT, MPOL_PREFERRED, MPOL_BIND, > > and MPOL_INTERLEAVE, are better declared as part of an enum for type > > checking. > > What type checking? There is none in standard C for enums. > "Type checking" probably

Re: [patch 1/4] mempolicy: convert MPOL constants to enum

2008-02-11 Thread Andi Kleen
On Monday 11 February 2008 16:30:32 David Rientjes wrote: > The mempolicy mode constants, MPOL_DEFAULT, MPOL_PREFERRED, MPOL_BIND, > and MPOL_INTERLEAVE, are better declared as part of an enum for type > checking. What type checking? There is none in standard C for enums. -Andi -- To unsubscribe

[patch 1/4] mempolicy: convert MPOL constants to enum

2008-02-11 Thread David Rientjes
The mempolicy mode constants, MPOL_DEFAULT, MPOL_PREFERRED, MPOL_BIND, and MPOL_INTERLEAVE, are better declared as part of an enum for type checking. The policy member of struct mempolicy is also converted from type short to type unsigned short. A negative policy does not have any legitimate

Re: [patch 1/4] mempolicy: convert MPOL constants to enum

2008-02-11 Thread Christoph Lameter
On Mon, 11 Feb 2008, David Rientjes wrote: On Mon, 11 Feb 2008, Christoph Lameter wrote: Then you could follow through with the enum mempolicy thing throughtout. Why not use enum mempolicy in struct mempolicy? Mempolicy flags, as I implemented them in patch 2 in this series, are not

Re: [patch 1/4] mempolicy: convert MPOL constants to enum

2008-02-11 Thread David Rientjes
On Mon, 11 Feb 2008, Christoph Lameter wrote: The policy member of struct mempolicy is also converted from type short to type unsigned short. A negative policy does not have any legitimate meaning, so it is possible to change its type in preparation for adding optional mode flags later.

Re: [patch 1/4] mempolicy: convert MPOL constants to enum

2008-02-11 Thread David Rientjes
On Mon, 11 Feb 2008, Andi Kleen wrote: The mempolicy mode constants, MPOL_DEFAULT, MPOL_PREFERRED, MPOL_BIND, and MPOL_INTERLEAVE, are better declared as part of an enum for type checking. What type checking? There is none in standard C for enums. Type checking probably isn't the best

[patch 1/4] mempolicy: convert MPOL constants to enum

2008-02-11 Thread David Rientjes
The mempolicy mode constants, MPOL_DEFAULT, MPOL_PREFERRED, MPOL_BIND, and MPOL_INTERLEAVE, are better declared as part of an enum for type checking. The policy member of struct mempolicy is also converted from type short to type unsigned short. A negative policy does not have any legitimate

Re: [patch 1/4] mempolicy: convert MPOL constants to enum

2008-02-11 Thread Christoph Lameter
On Mon, 11 Feb 2008, David Rientjes wrote: The second paragraphs seems to indicate that such an approach does not work since we also use MPOL_xx constants to set flags in the memory policies? Not sure I'm understanding your question, sorry. Mempolicy modes have always been int

Re: [patch 1/4] mempolicy: convert MPOL constants to enum

2008-02-11 Thread Andi Kleen
On Monday 11 February 2008 16:30:32 David Rientjes wrote: The mempolicy mode constants, MPOL_DEFAULT, MPOL_PREFERRED, MPOL_BIND, and MPOL_INTERLEAVE, are better declared as part of an enum for type checking. What type checking? There is none in standard C for enums. -Andi -- To unsubscribe

Re: [patch 1/4] mempolicy: convert MPOL constants to enum

2008-02-11 Thread Christoph Lameter
On Mon, 11 Feb 2008, David Rientjes wrote: The mempolicy mode constants, MPOL_DEFAULT, MPOL_PREFERRED, MPOL_BIND, and MPOL_INTERLEAVE, are better declared as part of an enum for type checking. The policy member of struct mempolicy is also converted from type short to type unsigned short.

Re: [patch 1/4] mempolicy: convert MPOL constants to enum

2008-02-11 Thread David Rientjes
On Mon, 11 Feb 2008, Christoph Lameter wrote: Then you could follow through with the enum mempolicy thing throughtout. Why not use enum mempolicy in struct mempolicy? Mempolicy flags, as I implemented them in patch 2 in this series, are not integer constants that are enumerated starting at