On Fri, Feb 19, 2010 at 02:06:45AM -0800, David Rientjes wrote: > On Fri, 19 Feb 2010, Nick Piggin wrote: > > But it doesn't matter if stores are done under lock, if the loads are > > not. masks can be multiple words, so there isn't any ordering between > > reading half and old mask and half a new one that results in an invalid > > state. AFAIKS. > > > > It doesn't matter for MAX_NUMNODES > BITS_PER_LONG because > task->mems_alllowed only gets updated via cpuset_change_task_nodemask() > where the added nodes are set and then the removed nodes are cleared. The > side effect of this lockless access to task->mems_allowed means we may > have a small race between > > nodes_or(tsk->mems_allowed, tsk->mems_allowed, *newmems); > > and > > tsk->mems_allowed = *newmems; > > but the penalty is that we get an allocation on a removed node, which > isn't a big deal, especially since it was previously allowed. If you have a concurrent reader without any synchronisation, then what stops it from loading a word of the mask before stores to add the new nodes and then loading another word of the mask after the stores to remove the old nodes? (which can give an empty mask). -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@xxxxxxxxxx For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"dont@xxxxxxxxx"> email@xxxxxxxxx </a>