From: Paul Jackson <pj@sgi.com>
To: vatsa@in.ibm.com
Cc: akpm@linux-foundation.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Fix race between attach_task and cpuset_exit
Date: Sun, 25 Mar 2007 12:50:25 -0700 [thread overview]
Message-ID: <20070325125025.b6e8f0d4.pj@sgi.com> (raw)
In-Reply-To: <20070325164746.GI11794@in.ibm.com>
> + task_lock(tsk);
> cs = tsk->cpuset;
> tsk->cpuset = &top_cpuset; /* the_top_cpuset_hack - see above */
> + atomic_dec(&cs->count);
> + task_unlock(tsk);
>
> if (notify_on_release(cs)) {
> char *pathbuf = NULL;
>
> mutex_lock(&manage_mutex);
> - if (atomic_dec_and_test(&cs->count))
> + if (!atomic_read(&cs->count))
> check_for_release(cs, &pathbuf);
Is there perhaps another race here? Could it happen that:
1) the atomic_dec() lowers the count to say one (any value > zero)
2) after we drop the task lock, some other task or tasks decrement
the count to zero
3) we catch that zero when we atomic_read the count, and issue a spurious
check_for_release().
I'm thinking that we should use the same oldcs_tobe_released logic
here as we used in attach_task, so that we do an atomic_dec_and_test()
inside the task lock, and if that hit zero, then we know that our
pointer to this cpuset is the last remaining reference, so we can
release that pointer at our convenience, knowing no one else can
reference or mess with that cpuset any more.
--
I won't rest till it's the best ...
Programmer, Linux Scalability
Paul Jackson <pj@sgi.com> 1.925.600.0401
next prev parent reply other threads:[~2007-03-25 19:50 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-03-25 16:47 Srivatsa Vaddagiri
2007-03-25 17:52 ` Balbir Singh
2007-03-25 19:54 ` Paul Jackson
2007-03-26 11:50 ` Srivatsa Vaddagiri
2007-03-26 17:58 ` Paul Jackson
2007-03-27 6:35 ` Srivatsa Vaddagiri
2007-03-27 8:45 ` Paul Jackson
2007-03-26 18:30 ` Paul Jackson
2007-03-25 19:50 ` Paul Jackson [this message]
2007-03-26 11:55 ` Srivatsa Vaddagiri
2007-04-05 5:55 ` Paul Menage
2007-04-05 7:00 ` Srivatsa Vaddagiri
2007-04-05 7:01 ` Paul Menage
2007-04-05 8:14 ` Srivatsa Vaddagiri
2007-04-05 8:10 ` Paul Menage
2007-04-10 17:12 ` Srivatsa Vaddagiri
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20070325125025.b6e8f0d4.pj@sgi.com \
--to=pj@sgi.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=vatsa@in.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome