[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <48D2A21E.7050806@linux.vnet.ibm.com>
Date: Thu, 18 Sep 2008 11:46:54 -0700
From: Balbir Singh <balbir@...ux.vnet.ibm.com>
To: righi.andrea@...il.com
CC: Andrew Morton <akpm@...ux-foundation.org>,
KAMEZAWA Hiroyuki <kamezawa.hiroyu@...fujitsu.com>,
Paul Menage <menage@...gle.com>,
containers@...ts.linux-foundation.org, linux-mm@...ck.org,
LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH -mm] memrlimit: fix task_lock() recursive locking
Andrea Righi wrote:
> cgroup_mm_owner_callbacks() can be called with task_lock() held in
> mm_update_next_owner(), and all the .mm_owner_changed callbacks seem to
> be *always* called with task_lock() held.
>
> Actually, memrlimit is using task_lock() via get_task_mm() in
> memrlimit_cgroup_mm_owner_changed(), raising the following recursive locking
> trace:
[snip]
Thanks for the BUG report()
[snip]
> static void memrlimit_cgroup_mm_owner_changed(struct cgroup_subsys *ss,
> struct cgroup *old_cgrp,
> @@ -246,7 +246,7 @@ static void memrlimit_cgroup_mm_owner_changed(struct cgroup_subsys *ss,
> struct task_struct *p)
> {
> struct memrlimit_cgroup *memrcg, *old_memrcg;
> - struct mm_struct *mm = get_task_mm(p);
> + struct mm_struct *mm = get_task_mm_task_locked(p);
>
Since we hold task_lock(), we know that p->mm cannot change and we don't have to
worry about incrementing mm_users. I think using just p->mm will work, we do
have checks to make sure we don't pick a kernel thread. I vote for going down
that road.
--
Balbir
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists