Re: [PATCH V2 4/4] cpuset,mm: update task's mems_allowed lazily

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Miao Xie
Date: Tuesday, March 9, 2010 - 12:25 am

on 2010-3-9 5:46, David Rientjes wrote:
[snip]

I worried about the consistency of task->mempolicy with task->mems_allowed for
configs where MAX_NUMNODES <= BITS_PER_LONG. 

The problem that I worried is fowllowing:
When the kernel allocator allocates pages for tasks, it will access task->mempolicy
first and get the allowed node, then check whether that node is allowed by
task->mems_allowed.

But, Without this patch, ->mempolicy and ->mems_allowed is not updated at the same
time. the kernel allocator may access the inconsistent information of ->mempolicy
and ->mems_allowed, sush as the allocator gets the allowed node from old mempolicy,
but checks whether that node is allowed by new mems_allowed which does't intersect
old mempolicy.

So I made this patchset.


I guarantee that no other kernel code changes tsk->mems_allowed when tsk != current.
so every task can  be safe to read tsk->mems_allowed without lock.

I will use mems_lock to protect it when other task reads. 


Yes, for all configs.


In this way, we must use rcu_read_lock() to protect task's cs, and the performance
will slowdown though rcu read lock's spending is very small.

Thanks!
Miao

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

Messages in current thread:
Re: [PATCH V2 4/4] cpuset,mm: update task's mems_allowed l ..., Miao Xie, (Tue Mar 9, 12:25 am)