(2012/06/27 14:35), David Rientjes wrote:
On Tue, 26 Jun 2012, David Rientjes wrote:
It's still not a perfect solution for the above reason. We need
tasklist_lock for oom_kill_process() for a few reasons:
(1) if /proc/sys/vm/oom_dump_tasks is enabled, which is the default,
to iterate the tasklist
(2) to iterate the selected process's children, and
(3) to iterate the tasklist to kill all other processes sharing the
same memory.
I'm hoping we can avoid taking tasklist_lock entirely for memcg ooms to
avoid the starvation problem at all. We definitely still need to do (3)
to avoid mm->mmap_sem deadlock if another thread sharing the same memory
is holding the semaphore trying to allocate memory and waiting for current
to exit, which needs the semaphore itself. That can be done with
rcu_read_lock(), however, and doesn't require tasklist_lock.
(1) can be done with rcu_read_lock() as well but I'm wondering if there
would be a significant advantage doing this by a cgroup iterator as well.
It may not be worth it just for the sanity of the code.
We can do (2) if we change to list_for_each_entry_rcu().
It turns out that task->children is not an rcu-protected list so this
doesn't work.
Can't we use sighand->lock to iterate children ?
Thanks,
-Kame
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxx. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@xxxxxxxxx"> email@xxxxxxxxx </a>