Re: [RFC] cpuset relative memory policies - second choice

From: David Rientjes
Date: Thu Nov 01 2007 - 14:52:54 EST


On Wed, 31 Oct 2007, Paul Jackson wrote:

> The basic reason that I went with an additional per-task modal
> state, rather than a modal flag for each mbind, set_mempolicy and
> get_mempolicy call was to reduce the likely rate of bugs in user
> level C code using this API.
>

I think it may be more error prone to accidently leave off the
get_mempolicy() system call to use the system-wide numbering or for
user-level code to forget that the mode was already set (and now stored in
their task_struct) without a subsequent get_mempolicy() to revert back to
the default behavior. Both of these problems can be addressed by checking
the *policy returned by get_mempolicy(), as you've coded it, but many
applications will probably ignore that overhead.

Allowing the mode to be passed on each set_mempolicy() system call seems
better, this is where the nodemask is passed anyway so it's legitimate for
the caller to specify how that nodemask should be interpreted (either
system-wide or cpuset-wide). This keeps all semantics of the nodemask to
a single invocation of a system call instead of setting policy modes with
get_mempolicy() and confusing the matter later.

I think get_mempolicy() can remain unchanged because it will simply return
the contextualized nodemask in either case and would not require a mode to
be passed.

David
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/