[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20070326115046.GK11794@in.ibm.com>
Date: Mon, 26 Mar 2007 17:20:46 +0530
From: Srivatsa Vaddagiri <vatsa@...ibm.com>
To: Balbir Singh <balbir@...ibm.com>
Cc: pj@....com, akpm@...ux-foundation.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] Fix race between attach_task and cpuset_exit
On Sun, Mar 25, 2007 at 11:22:15PM +0530, Balbir Singh wrote:
> >+ struct cpuset *oldcs_tobe_released = NULL;
>
> How about oldcs_to_be_released?
Yes, I wanted to use that, but my typo I guess.
> >@@ -2242,19 +2241,20 @@ void cpuset_exit(struct task_struct *tsk
> > {
> > struct cpuset *cs;
> >
> >+ task_lock(tsk);
> > cs = tsk->cpuset;
> > tsk->cpuset = &top_cpuset; /* the_top_cpuset_hack - see above */
> >+ atomic_dec(&cs->count);
>
> How about using a local variable like ref_count and using
>
> ref_count = atomic_dec_and_test(&cs->count); This will avoid the two
> atomic operations, atomic_dec() and atomic_read() below.
Well, someone may have attached to this cpuset while we were waiting on the
mutex_lock(). So we need to do a atomic_read again to ensure it is still
unused. But I notice that check_for_release() has that
atomic_read-and-check-for-zero-refcount inbuilt into it, which means we can
blindly call it. Modified patch in another mail.
--
Regards,
vatsa
-
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