Re: [mm] [PATCH 3/4] Memory cgroup hierarchical reclaim (v4)

From: Balbir Singh
Date: Tue Nov 25 2008 - 10:01:43 EST


Daisuke Nishimura wrote:
> Hi.
>
> Unfortunately, trying to hold cgroup_mutex at reclaim causes dead lock.
>
> For example, when attaching a task to some cpuset directory(memory_migrate=on),
>
> cgroup_tasks_write (hold cgroup_mutex)
> attach_task_by_pid
> cgroup_attach_task
> cpuset_attach
> cpuset_migrate_mm
> :
> unmap_and_move
> mem_cgroup_prepare_migration
> mem_cgroup_try_charge
> mem_cgroup_hierarchical_reclaim
>

Did lockdep complain about it?

1. We could probably move away from cgroup_mutex to a memory controller specific
mutex.
2. We could give up cgroup_mutex before migrate_mm, since it seems like we'll
hold the cgroup lock for long and holding it during reclaim will definitely be
visible to users trying to create/delete nodes.

I prefer to do (2), I'll look at the code more closely

> I think similar problem can also happen when removing memcg's directory.
>

Why removing a directory? memcg (now) marks the directory as obsolete and we
check for obsolete directories and get/put references.

Thanks for the bug report!

--
Balbir
--
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/