From: Roland McGrath <roland@redhat.com>
To: Frank Mayhar <fmayhar@google.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: posix-cpu-timers revamp
Date: Tue, 8 Apr 2008 15:49:02 -0700 (PDT) [thread overview]
Message-ID: <20080408224902.5BEB026F992@magilla.localdomain> (raw)
In-Reply-To: Frank Mayhar's message of Tuesday, 8 April 2008 14:27:54 -0700 <1207690074.4687.18.camel@bobble.smo.corp.google.com>
My explanation about the constraints on exit_state was specifically about
the context of update_process_times(), which is part of the path for a
clock tick interrupting current.
> And, you guessed it, the invariant gets violated. Apparently the passed
> task_struct isn't the same as "current" at this point.
The scheduler code has gotten a lot more complex since I first implemented
posix-cpu-timers, and I've never been any expert on the scheduler at all.
But I'm moderately sure all those things are all involved in context
switch where the task of interest is about to be on a CPU or just was on a
CPU. I doubt those are places where the task in question could be
simultaneously executing in exit_notify() on another CPU. But we'd need
to ask the scheduler experts to be sure we know what we're talking about
there.
> Found the exception. do_fork() violates the invariant when it's
> cranking up a new process. Hmmm.
I haven't figured out what actual code path this refers to.
This sort of concern is among the reasons that checking ->signal was the
course I found wise to suggest to begin with. We can figure out what the
constraints on ->exit_state are in all the places by understanding every
corner of the scheduler. We can measure whether it winds up being in a
cooler cache line than ->signal and a net loss to add the load, or has
superior performance as you seem to think. Or we can just test the
constraint that matters, whether the pointer we loaded was in fact null,
and rely on RCU to make it not matter if there is a race after that load.
It doesn't matter whether tsk is current or not, it only matters that we
have the pointer and that we're using some CPU array slot or other that
noone else is using simultaneously.
static inline void account_group_exec_runtime(struct task_struct *tsk,
unsigned long long runtime)
{
struct signal_struct *sig;
struct task_cputime *times;
rcu_read_lock();
sig = rcu_dereference(tsk->signal);
if (likely(sig) && sig->cputime.totals) {
times = per_cpu_ptr(sig->cputime.totals, get_cpu());
times->sum_exec_runtime += runtime;
put_cpu_no_resched();
}
rcu_read_unlock();
}
Thanks,
Roland
next prev parent reply other threads:[~2008-04-08 22:49 UTC|newest]
Thread overview: 51+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <bug-9906-10286@http.bugzilla.kernel.org/>
2008-02-07 0:50 ` [Bugme-new] [Bug 9906] New: Weird hang with NPTL and SIGPROF Andrew Morton
2008-02-07 0:58 ` Frank Mayhar
2008-02-07 2:57 ` Parag Warudkar
2008-02-07 15:22 ` Alejandro Riveira Fernández
2008-02-07 15:53 ` Parag Warudkar
2008-02-07 15:56 ` Parag Warudkar
2008-02-07 15:54 ` Alejandro Riveira Fernández
2008-02-07 16:01 ` Parag Warudkar
2008-02-07 16:53 ` Parag Warudkar
2008-02-29 19:55 ` Frank Mayhar
2008-03-04 7:00 ` Roland McGrath
2008-03-04 19:52 ` Frank Mayhar
2008-03-05 4:08 ` Roland McGrath
2008-03-06 19:04 ` Frank Mayhar
2008-03-11 7:50 ` posix-cpu-timers revamp Roland McGrath
2008-03-11 21:05 ` Frank Mayhar
2008-03-11 21:35 ` Roland McGrath
2008-03-14 0:37 ` Frank Mayhar
2008-03-21 7:18 ` Roland McGrath
2008-03-21 17:57 ` Frank Mayhar
2008-03-22 21:58 ` Roland McGrath
2008-03-24 17:34 ` Frank Mayhar
2008-03-24 22:43 ` Frank Mayhar
2008-03-31 5:44 ` Roland McGrath
2008-03-31 20:24 ` Frank Mayhar
2008-04-02 2:07 ` Roland McGrath
2008-04-02 16:34 ` Frank Mayhar
2008-04-02 17:42 ` Frank Mayhar
2008-04-02 19:48 ` Roland McGrath
2008-04-02 20:34 ` Frank Mayhar
2008-04-02 21:42 ` Frank Mayhar
2008-04-04 0:53 ` Frank Mayhar
2008-04-04 23:17 ` Roland McGrath
2008-04-06 5:26 ` Frank Mayhar
2008-04-07 20:08 ` Roland McGrath
2008-04-07 21:31 ` Frank Mayhar
2008-04-07 22:02 ` Roland McGrath
2008-04-08 21:27 ` Frank Mayhar
2008-04-08 21:52 ` Frank Mayhar
2008-04-08 22:49 ` Roland McGrath [this message]
2008-04-09 16:29 ` Frank Mayhar
2008-04-02 18:42 ` Frank Mayhar
2008-03-28 0:52 ` [PATCH 2.6.25-rc6] Fix itimer/many thread hang Frank Mayhar
2008-03-28 10:28 ` Ingo Molnar
2008-03-28 22:46 ` [PATCH 2.6.25-rc7 resubmit] " Frank Mayhar
2008-04-01 18:45 ` Andrew Morton
2008-04-01 21:46 ` Frank Mayhar
2008-03-21 20:40 ` posix-cpu-timers revamp Frank Mayhar
2008-03-07 23:26 ` [Bugme-new] [Bug 9906] New: Weird hang with NPTL and SIGPROF Frank Mayhar
2008-03-08 0:01 ` Frank Mayhar
2008-02-07 17:36 ` Frank Mayhar
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=20080408224902.5BEB026F992@magilla.localdomain \
--to=roland@redhat.com \
--cc=fmayhar@google.com \
--cc=linux-kernel@vger.kernel.org \
/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®