Re: [patch 3/4] mempolicy: add MPOL_F_STATIC_NODES flag

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Lee Schermerhorn
Date: Wednesday, February 13, 2008 - 9:01 am

On Wed, 2008-02-13 at 01:36 -0800, David Rientjes wrote:

I was hoping David wouldn't cave on this point. ;-)  I do agree with
David that if we ever end up with nr_modes + nr_mode_flags > 16, the API
will become too complex for myself, at least, to comprehend.  I don't
feel too strongly either way, and I'll explain more below, but first:

I do agree with Paul that there is a danger of missing one of these in
converting existing code.  In fact, I missed one in my ref counting
rework patch that I will ultimately rebase atop David's final version
[I'm already dependent on Mel Gorman's patch series].  To catch this, I
decided to rename the "policy" member to "mode".  This also aligns the
struct better with the numa_memory_policy doc [I think of the "policy"
as the tuple:  mode + optional nodemask].  For future code, I think we
could add comments to the struct definition warning that one should use
the wrappers to access the mode or mode flags.

However, let's step back and look at the usage of the mempolicy struct.
In earlier mail, David mentioned that it is passed around outside of
mempolicy.c.  While this is true, the only place that I see where code
outside of mempolicy.c deals with the policy/mode and nodemask
separately--as opposed to using an opaque mempolicy struct--is in the
shmem mount option parsing.  Everywhere else, as far as I can see, just
uses the struct mempolicy.  Even slab/slub call into slab_node() in
mempolicy.c to extract the target node for the policy.

So, if David does accept Paul's plea to separate the mode and the mode
flags in the structure, I would suggest that we do this in mpol_new().
That is, in {sys|do}_{set_mempolicy|mbind}(), maintain the API format
with the mode flags ORed into the mode.  mpol_new() can pull them apart
into different struct mempolicy members.  The rest of mempolicy.c can
use them directly from the struct without the helpers.  get_mempolicy()
will need to pack the mode and flags back together--perhaps with an
inverse helper function.

As for the shmem mount option parsing:  For now, I'd suggest that we
keep the mode flags OR'd into the "policy" member of the shmem_sb_info
struct -- i.e., the "API format"--to preserve the mpol_new() interface.
At some point [no urgency, I think], I'd like to replace the
shmem_sb_info policy and nodemask members with a struct mempolicy or
pointer thereto, and instead of using mpol_new() to create the mempolicy
for new tmpfs inodes, use mpol_copy() [which should probably be renamed
to mpol_dup(), 'cause that's what it does].  I'd also like to move
shmem_parse_mpol() to mempolicy.c as a more general memory policy
parser.  shmem_show_mpol() can probably be reworked to use mpol_to_str()
used by show_numa_map().   Again, no urgency.  I'd rather see David's
and Mel's and my pending mempolicy patches settle down and get in first.
[Too many interdependent out of tree mempolicy patches, already :-(]


Note:  I agree that the 'STATIC' flag overrides the argument checking
you refer to above.  That's new behavior that the application has
indicated that it wants to use.  However, methinks that MPOL_DEFAULT|
MPOL_F_STATIC_NODES doesn't make much sense.

Regards,
Lee

--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[patch 1/4] mempolicy: convert MPOL constants to enum, David Rientjes, (Mon Feb 11, 8:30 am)
[patch 2/4] mempolicy: support optional mode flags, David Rientjes, (Mon Feb 11, 8:30 am)
[patch 3/4] mempolicy: add MPOL_F_STATIC_NODES flag, David Rientjes, (Mon Feb 11, 8:30 am)
Re: [patch 2/4] mempolicy: support optional mode flags, Lee Schermerhorn, (Mon Feb 11, 9:36 am)
Re: [patch 3/4] mempolicy: add MPOL_F_STATIC_NODES flag, KOSAKI Motohiro, (Mon Feb 11, 11:25 am)
Re: [patch 1/4] mempolicy: convert MPOL constants to enum, David Rientjes, (Mon Feb 11, 12:25 pm)
Re: [patch 1/4] mempolicy: convert MPOL constants to enum, Christoph Lameter, (Mon Feb 11, 12:32 pm)
Re: [patch 2/4] mempolicy: support optional mode flags, David Rientjes, (Mon Feb 11, 12:34 pm)
Re: [patch 3/4] mempolicy: add MPOL_F_STATIC_NODES flag, Christoph Lameter, (Mon Feb 11, 12:34 pm)
Re: [patch 1/4] mempolicy: convert MPOL constants to enum, David Rientjes, (Mon Feb 11, 12:40 pm)
Re: [patch 1/4] mempolicy: convert MPOL constants to enum, Christoph Lameter, (Mon Feb 11, 12:48 pm)
Re: [patch 3/4] mempolicy: add MPOL_F_STATIC_NODES flag, David Rientjes, (Mon Feb 11, 12:56 pm)
Re: [patch 1/4] mempolicy: convert MPOL constants to enum, David Rientjes, (Mon Feb 11, 1:02 pm)
Re: [patch 1/4] mempolicy: convert MPOL constants to enum, Christoph Lameter, (Mon Feb 11, 1:45 pm)
Re: [patch 2/4] mempolicy: support optional mode flags, Paul Jackson, (Mon Feb 11, 1:55 pm)
Re: [patch 2/4] mempolicy: support optional mode flags, David Rientjes, (Mon Feb 11, 2:52 pm)
Re: [patch 2/4] mempolicy: support optional mode flags, Paul Jackson, (Mon Feb 11, 2:57 pm)
Re: [patch 2/4] mempolicy: support optional mode flags, Lee Schermerhorn, (Tue Feb 12, 8:31 am)
Re: [patch 2/4] mempolicy: support optional mode flags, David Rientjes, (Tue Feb 12, 12:14 pm)
Re: [patch 1/4] mempolicy: convert MPOL constants to enum, Lee Schermerhorn, (Tue Feb 12, 5:10 pm)
Re: [patch 2/4] mempolicy: support optional mode flags, Lee Schermerhorn, (Tue Feb 12, 5:14 pm)
Re: [patch 3/4] mempolicy: add MPOL_F_STATIC_NODES flag, Lee Schermerhorn, (Tue Feb 12, 5:22 pm)
Re: [patch 3/4] mempolicy: add MPOL_F_STATIC_NODES flag, Lee Schermerhorn, (Tue Feb 12, 5:25 pm)
Re: [patch 2/4] mempolicy: support optional mode flags, David Rientjes, (Tue Feb 12, 5:25 pm)
Re: [patch 1/4] mempolicy: convert MPOL constants to enum, David Rientjes, (Tue Feb 12, 5:53 pm)
Re: [patch 3/4] mempolicy: add MPOL_F_STATIC_NODES flag, David Rientjes, (Tue Feb 12, 5:57 pm)
Re: [patch 1/4] mempolicy: convert MPOL constants to enum, Christoph Lameter, (Tue Feb 12, 6:04 pm)
Re: [patch 1/4] mempolicy: convert MPOL constants to enum, David Rientjes, (Tue Feb 12, 7:00 pm)
Re: [patch 1/4] mempolicy: convert MPOL constants to enum, David Rientjes, (Tue Feb 12, 7:42 pm)
Re: [patch 1/4] mempolicy: convert MPOL constants to enum, David Rientjes, (Tue Feb 12, 8:17 pm)
Re: [patch 3/4] mempolicy: add MPOL_F_STATIC_NODES flag, Paul Jackson, (Tue Feb 12, 8:52 pm)
Re: [patch 3/4] mempolicy: add MPOL_F_STATIC_NODES flag, David Rientjes, (Tue Feb 12, 9:03 pm)
Re: [patch 3/4] mempolicy: add MPOL_F_STATIC_NODES flag, Paul Jackson, (Tue Feb 12, 9:13 pm)
Re: [patch 3/4] mempolicy: add MPOL_F_STATIC_NODES flag, David Rientjes, (Tue Feb 12, 9:18 pm)
Re: [patch 3/4] mempolicy: add MPOL_F_STATIC_NODES flag, David Rientjes, (Tue Feb 12, 9:23 pm)
Re: [patch 3/4] mempolicy: add MPOL_F_STATIC_NODES flag, David Rientjes, (Tue Feb 12, 10:06 pm)
Re: [patch 3/4] mempolicy: add MPOL_F_STATIC_NODES flag, Paul Jackson, (Wed Feb 13, 1:03 am)
Re: [patch 3/4] mempolicy: add MPOL_F_STATIC_NODES flag, David Rientjes, (Wed Feb 13, 2:36 am)
Re: [patch 3/4] mempolicy: add MPOL_F_STATIC_NODES flag, Lee Schermerhorn, (Wed Feb 13, 8:15 am)
Re: [patch 3/4] mempolicy: add MPOL_F_STATIC_NODES flag, Lee Schermerhorn, (Wed Feb 13, 9:01 am)
Re: [patch 3/4] mempolicy: add MPOL_F_STATIC_NODES flag, Lee Schermerhorn, (Wed Feb 13, 9:14 am)
Re: [patch 3/4] mempolicy: add MPOL_F_STATIC_NODES flag, Paul Jackson, (Wed Feb 13, 10:04 am)
Re: [patch 3/4] mempolicy: add MPOL_F_STATIC_NODES flag, David Rientjes, (Wed Feb 13, 11:48 am)
Re: [patch 3/4] mempolicy: add MPOL_F_STATIC_NODES flag, Paul Jackson, (Wed Feb 13, 11:58 am)
Re: [patch 3/4] mempolicy: add MPOL_F_STATIC_NODES flag, David Rientjes, (Wed Feb 13, 12:02 pm)
Re: [patch 3/4] mempolicy: add MPOL_F_STATIC_NODES flag, Lee Schermerhorn, (Wed Feb 13, 12:05 pm)
Re: [patch 3/4] mempolicy: add MPOL_F_STATIC_NODES flag, David Rientjes, (Wed Feb 13, 12:12 pm)
Re: [patch 3/4] mempolicy: add MPOL_F_STATIC_NODES flag, David Rientjes, (Wed Feb 13, 12:17 pm)
Re: [patch 3/4] mempolicy: add MPOL_F_STATIC_NODES flag, Paul Jackson, (Wed Feb 13, 1:29 pm)
Re: [patch 3/4] mempolicy: add MPOL_F_STATIC_NODES flag, David Rientjes, (Wed Feb 13, 2:35 pm)
Re: [patch 3/4] mempolicy: add MPOL_F_STATIC_NODES flag, Paul Jackson, (Thu Feb 14, 3:09 am)
Re: [patch 3/4] mempolicy: add MPOL_F_STATIC_NODES flag, Paul Jackson, (Thu Feb 14, 3:26 am)
Re: [patch 3/4] mempolicy: add MPOL_F_STATIC_NODES flag, Paul Jackson, (Thu Feb 14, 4:12 am)
Re: [patch 3/4] mempolicy: add MPOL_F_STATIC_NODES flag, Paul Jackson, (Thu Feb 14, 5:27 am)
Re: [patch 3/4] mempolicy: add MPOL_F_STATIC_NODES flag, David Rientjes, (Thu Feb 14, 12:40 pm)
Re: [patch 3/4] mempolicy: add MPOL_F_STATIC_NODES flag, David Rientjes, (Thu Feb 14, 12:45 pm)
Re: [patch 3/4] mempolicy: add MPOL_F_STATIC_NODES flag, David Rientjes, (Thu Feb 14, 2:38 pm)
Re: [patch 3/4] mempolicy: add MPOL_F_STATIC_NODES flag, David Rientjes, (Thu Feb 14, 6:44 pm)
Re: [patch 3/4] mempolicy: add MPOL_F_STATIC_NODES flag, Paul Jackson, (Fri Feb 15, 2:27 am)
Re: [patch 3/4] mempolicy: add MPOL_F_STATIC_NODES flag, Paul Jackson, (Fri Feb 15, 3:00 am)
Re: [patch 3/4] mempolicy: add MPOL_F_STATIC_NODES flag, Paul Jackson, (Fri Feb 15, 3:19 am)
Re: [patch 3/4] mempolicy: add MPOL_F_STATIC_NODES flag, David Rientjes, (Fri Feb 15, 1:14 pm)
Re: [patch 3/4] mempolicy: add MPOL_F_STATIC_NODES flag, David Rientjes, (Fri Feb 15, 1:23 pm)
Re: [patch 3/4] mempolicy: add MPOL_F_STATIC_NODES flag, David Rientjes, (Fri Feb 15, 1:32 pm)
Re: [patch 3/4] mempolicy: add MPOL_F_STATIC_NODES flag, Paul Jackson, (Fri Feb 15, 4:45 pm)
Re: [patch 3/4] mempolicy: add MPOL_F_STATIC_NODES flag, David Rientjes, (Fri Feb 15, 4:55 pm)
Re: [patch 3/4] mempolicy: add MPOL_F_STATIC_NODES flag, Paul Jackson, (Fri Feb 15, 5:11 pm)