Re: [patch] cpusets: avoid looping when storing to mems_allowed ifone node remains set

From: David Rientjes
Date: Tue Sep 13 2011 - 18:06:16 EST


On Tue, 13 Sep 2011, Miao Xie wrote:

> This patch is dangerous if the task has a bind memory policy that was set
> to be neither MPOL_F_STATIC_NODES nor MPOL_F_RELATIVE_NODES, because the
> memory policy use node_remap() to rebind the allowed nodes, but node_remap()
> may make the old mask and the new mask nonoverlapping. So at this condition,
> the task may also see an empty node mask.
>

The vast majority of cpuset users are not going to have mempolicies at
all, the cpuset itself is the only policy they need to take advantage of
the NUMA locality of their machine. I'd be find with checking for
!tsk->mempolicy in this exception as well since we already hold
task_lock(tsk), but I think the real fix would be to make sure that an
empty nodemask is never returned by mempolicies. Something like ensuring
that if the preferred node is MAX_NUMNODES (since it is determined by
using first_node() over a possibly racing empty nodemask) that the first
online node is returned during the race and that
node_states[N_HIGH_MEMORY] is returned if an MPOL_BIND or MPOL_INTERLEAVE
mask is empty. Thoughts?
--
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/