[bug ?] do_get_mempolicy()

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: <linux-kernel@...>
Cc: Lee Schermerhorn <lee.schermerhorn@...>, Joe Korty <joe.korty@...>
Date: Thursday, July 3, 2008 - 4:44 pm

Hi Lee,

I'm having unexpected results with get_mempolicy(2) in 2.6.26, and
I am hoping that you can either agree with me, or maybe comment on my
misconceptions.

When I have a task with no special task mempolicy (the default mempolicy),
when I call get_mempolicy(2), it returns a policy value of 2 (MPOL_BIND)
with a NULL nodemask.

I believe that this is because of the code in do_get_mempolicy() that does:

  *policy |= pol->flags;

in the else case when flags do not contain MPOL_F_NODE.

I guess I don't understand why we are ORing in the pol->flags into the
*policy value.  For example, when this is for the default_policy, the
MPOL_F_LOCAL flag (which has a value of 2) gets stuffed into the *policy
location, and a get_mempolicy(2) caller sees this as the MPOL_BIND
mempolicy.

Maybe the "*policy |= pol->flags;" line should be removed ?

That is, maybe it was valid at some point, but subsequent changes
make this line of code no longer valid ?

Sorry if I'm out-to-lunch here...

Thanks very much for you time and considerations on this issue.

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

Messages in current thread:
[bug ?] do_get_mempolicy(), John Blackwood, (Thu Jul 3, 4:44 pm)
Re: [bug ?] do_get_mempolicy(), Lee Schermerhorn, (Tue Jul 8, 9:23 am)
Re: [bug ?] do_get_mempolicy(), David Rientjes, (Thu Jul 3, 5:44 pm)
Re: [bug ?] do_get_mempolicy(), Lee Schermerhorn, (Tue Jul 8, 9:43 am)
Re: [bug ?] do_get_mempolicy(), David Rientjes, (Mon Jul 7, 3:05 am)