From: Oleg Nesterov <oleg@redhat.com>
To: Dario Faggioli <raistlin@linux.it>
Cc: Thomas Gleixner <tglx@linutronix.de>,
linux-kernel <linux-kernel@vger.kernel.org>,
torbenh <torbenh@gmx.de>,
john.stultz@linaro.org, roland@redhat.com,
Ingo Molnar <mingo@elte.hu>,
Peter Zijlstra <peterz@infradead.org>,
Stanislaw Gruszka <sgruszka@redhat.com>
Subject: Re: [PATCH] Read THREAD_CPUTIME clock from other processes.
Date: Thu, 23 Dec 2010 19:12:13 +0100 [thread overview]
Message-ID: <20101223181213.GA16501@redhat.com> (raw)
In-Reply-To: <1293125901.2748.10.camel@Palantir>
On 12/23, Dario Faggioli wrote:
>
> On Thu, 2010-12-23 at 17:44 +0100, Oleg Nesterov wrote:
> > > Therefore, this patch removes such limitation and enables the
> > > following behaviour, for the threaded and process-based case,
> > > respectively:
> >
> > Can't comment, I never understood this.
> >
> If I can ask... What's that you never understood? Why the limitation is
> there?
Yes. IOW, I agree it looks strange, clock_gettime() can sample the
whole group but not a single thread.
> > > @@ -349,18 +347,21 @@ int posix_cpu_clock_get(const clockid_t which_clock, struct timespec *tp)
> > > rcu_read_lock();
> > > p = find_task_by_vpid(pid);
> > > if (p) {
> > > - if (CPUCLOCK_PERTHREAD(which_clock)) {
> > > - if (same_thread_group(p, current)) {
> > > - error = cpu_clock_sample(which_clock,
> > > - p, &rtn);
> > > - }
> > > +
> > > + if (CPUCLOCK_PERTHREAD(which_clock) &&
> > > + same_thread_group(p, current)) {
> > > + error = cpu_clock_sample(which_clock,
> > > + p, &rtn);
> > > } else {
> > > read_lock(&tasklist_lock);
> > > - if (thread_group_leader(p) && p->sighand) {
> > > + if (!CPUCLOCK_PERTHREAD(which_clock) &&
> > > + thread_group_leader(p) && p->sighand)
> > > error =
> > > cpu_clock_sample_group(which_clock,
> > > - p, &rtn);
> > > - }
> > > + p, &rtn);
> > > + else
> > > + error = cpu_clock_sample(which_clock,
> > > + p, &rtn);
> > > read_unlock(&tasklist_lock);
> >
> > Can't understand... why did you duplicate cpu_clock_sample() ?
> >
> > IOW, it seems to me you could simply kill the
> > "if (same_thread_group(p, current)) {" line with the same efect, no?
> >
> Well, yes, but looking at the original code I thought that in the !
> same_thread_group() case I might need the tasklist_lock...
>
> Am I wrong? Is it there just because of cpu_clock_sample_group()?
Yes, it is because of _group (we are going to sample all sub-threads),
not because of !same_thread_group().
Oh. In fact we should remove this tasklist, but this is another story.
Oleg.
next prev parent reply other threads:[~2010-12-23 18:19 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-12-23 16:21 [PATCH] Read THREAD_CPUTIME clock from other processes Dario Faggioli
2010-12-23 16:44 ` Oleg Nesterov
2010-12-23 17:38 ` Dario Faggioli
2010-12-23 18:12 ` Oleg Nesterov [this message]
2010-12-24 11:36 ` Dario Faggioli
2010-12-23 17:21 ` Randy Dunlap
2010-12-23 17:43 ` Dario Faggioli
2010-12-28 10:55 ` [PATCH resend] Reading POSIX CPU timer from outside the process Dario Faggioli
2010-12-28 16:38 ` Oleg Nesterov
2010-12-28 21:38 ` Dario Faggioli
2010-12-29 13:21 ` Oleg Nesterov
2010-12-29 14:10 ` Dario Faggioli
2010-12-29 18:30 ` Oleg Nesterov
2010-12-30 17:45 ` torbenh
2011-01-04 11:01 ` Dario Faggioli
2011-01-06 16:06 ` torbenh
2011-01-07 19:28 ` [PATCH] Read THREAD_CPUTIME clock from other processes Roland McGrath
2011-01-07 19:35 ` Oleg Nesterov
2011-01-07 19:50 ` Roland McGrath
2011-01-07 19:49 ` Oleg Nesterov
2011-01-07 19:58 ` Roland McGrath
2011-01-07 19:56 ` Peter Zijlstra
2011-01-08 11:12 ` Dario Faggioli
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=20101223181213.GA16501@redhat.com \
--to=oleg@redhat.com \
--cc=john.stultz@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=peterz@infradead.org \
--cc=raistlin@linux.it \
--cc=roland@redhat.com \
--cc=sgruszka@redhat.com \
--cc=tglx@linutronix.de \
--cc=torbenh@gmx.de \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.