[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20070430172352.GA8567@infradead.org>
Date: Mon, 30 Apr 2007 18:23:52 +0100
From: Christoph Hellwig <hch@...radead.org>
To: Srivatsa Vaddagiri <vatsa@...ibm.com>
Cc: Paul Jackson <pj@....com>, menage@...gle.com,
akpm@...ux-foundation.org, dev@...ru, xemul@...ru,
serue@...ibm.com, ebiederm@...ssion.com, haveblue@...ibm.com,
svaidy@...ux.vnet.ibm.com, balbir@...ibm.com,
ckrm-tech@...ts.sourceforge.net, linux-kernel@...r.kernel.org,
rohitseth@...gle.com, mbligh@...gle.com, containers@...ts.osdl.org,
devel@...nvz.org
Subject: Re: [PATCH 0/9] Containers (V9): Generic Process Containers
On Mon, Apr 30, 2007 at 10:42:25PM +0530, Srivatsa Vaddagiri wrote:
> On Sun, Apr 29, 2007 at 02:37:21AM -0700, Paul Jackson wrote:
> > It builds and boots and mounts the cpuset file system ok.
> > But trying to write the 'mems' file hangs the system hard.
>
> Basically we are attempting a read_lock(&tasklist_lock) in
> container_task_count() after taking write_lock_irq(&tasklist_lock) in
> update_nodemask()!
>
> This patch seems to fix the prb for me:
>
>
> Fix write_lock() followed by read_lock() bug by introducing a 2nd
> argument to be passed into container_task_count. Other choice is to
> introduce a lock and unlocked versions of container_task_count() ..
>
> Signed-off-by : Srivatsa Vaddagiri <vatsa@...ibm.com>
> -int container_task_count(const struct container *cont) {
> +int container_task_count(const struct container *cont, int take_lock) {
> int count = 0;
> struct task_struct *g, *p;
> struct container_subsys_state *css;
> int subsys_id;
> get_first_subsys(cont, &css, &subsys_id);
>
> - read_lock(&tasklist_lock);
> + if (take_lock)
> + read_lock(&tasklist_lock);
> do_each_thread(g, p) {
> if (task_subsys_state(p, subsys_id) == css)
> count ++;
> } while_each_thread(g, p);
> - read_unlock(&tasklist_lock);
> + if (take_lock)
> + read_unlock(&tasklist_lock);
> return count;
Umm, no - please naje two versions with and without the lock. Also
Please fix up the codingstyle, the { belongs onto a line of it's own.
-
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