From: ebiederm@xmission.com (Eric W. Biederman)
To: Oleg Nesterov <oleg@tv-sign.ru>
Cc: Andrew Morton <akpm@osdl.org>,
linux-kernel@vger.kernel.org,
"Paul E. McKenney" <paulmck@us.ibm.com>,
Ingo Molnar <mingo@elte.hu>, William Irwin <wli@holomorphy.com>,
Roland McGrath <roland@redhat.com>
Subject: Re: [PATCH] task: Make task list manipulations RCU safe.
Date: Tue, 14 Mar 2006 11:06:52 -0700 [thread overview]
Message-ID: <m18xrcnbnn.fsf@ebiederm.dsl.xmission.com> (raw)
In-Reply-To: <4416FF1F.5DA06CFB@tv-sign.ru> (Oleg Nesterov's message of "Tue, 14 Mar 2006 20:36:31 +0300")
Oleg Nesterov <oleg@tv-sign.ru> writes:
> Some questions.
>
> first_tgid:
> ...
> for (; pos && pid_alive(pos); pos = next_task(pos))
>
> I think this patch makes this 'pid_alive(pos)' unneeded?
Close. The problem is that we could have slept with the
count elevated on start before we do rcu_read_lock().
> next_tgid:
> rcu_read_lock();
> pos = start;
> if (pid_alive(start))
> pos = next_task(start);
> if (pid_alive(pos) && (pos != &init_task)) {
> get_task_struct(pos);
> goto done;
> }
>
> The first 'pid_alive()' check is quite understandable.
> What about the second one? I beleive, now it is unneeded
> as well. The same for first_tid/next_tid.
Agreed. Since we are guaranteed that ->next will still
be valid we should be able to get this down to a single
pid_alive check. Although I'm not certain I would want
to return a task that had just died from either of these functions.
But I guess the race is there regardless.
> Also, first_tid() does 'task_lock(leader)' while reading
> ->signal->count. Why? ->signal is protected by ->siglock,
> but we don't need any locks because ->signal is rcu safe.
> Same for proc_task_getattr(), s/task_lock/rcu_read_lock/.
Probably my general paranoia. I know I didn't quite grok
rcu at the time I wrote that code, and I could have easily
gotten confused about what task_lock protects. Looks like
I need to generate a patch to cleanup that one.
Eric
next prev parent reply other threads:[~2006-03-14 18:08 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-03-08 16:42 Eric W. Biederman
2006-03-14 17:36 ` Oleg Nesterov
2006-03-14 18:06 ` Eric W. Biederman [this message]
2006-03-14 18:26 ` Oleg Nesterov
2006-03-14 20:15 ` Eric W. Biederman
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=m18xrcnbnn.fsf@ebiederm.dsl.xmission.com \
--to=ebiederm@xmission.com \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=oleg@tv-sign.ru \
--cc=paulmck@us.ibm.com \
--cc=roland@redhat.com \
--cc=wli@holomorphy.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
all inboxes | Powered by JetHome®