Re: [PATCH] cpuset: fix allocating page cache/slab object on the unallowed node when memory spread is set

Paul Menage
2009-01-21T10:42:37Z

On Wed, Jan 21, 2009 at 12:06 AM, Miao Xie <miaox@cn.fujitsu.com> wrote:
> The task still allocated the page caches on old node after modifying its
> cpuset's mems when 'memory_spread_page' was set, it is caused by the old
> mem_allowed_list of the task, the current kernel doesn't updates it unless some
> function invokes cpuset_update_task_memory_state(), it is too late sometimes.

Can you give a more concrete example of how the current code can break?

> We must update the mem_allowed_list of the tasks in time.

This is a fairly fundamental change to the way that mems_allowed is
handled - it dates back to fairly early in cpusets' history.

> - * The task_struct fields mems_allowed and mems_generation may only
> - * be accessed in the context of that task, so require no locks.
> + * The task_struct fields mems_allowed may only be accessed in the context
> + * of that task, so require no locks.

This comment is no longer true, since mems_allowed is now being
updated by other processes.

What's to stop a task reading current->mems_allowed and racing with an
update from update_tasks_nodemask() ? Or else, why can that not lead
to badness?

Paul