From: "Chris Friesen" <cfriesen@nortel.com>
To: Thomas Gleixner <tglx@linutronix.de>
Cc: LKML <linux-kernel@vger.kernel.org>,
Ulrich Drepper <drepper@redhat.com>,
Roland McGrath <roland@redhat.com>
Subject: Re: linux missing support for _POSIX_THREAD_CPUTIME?
Date: Wed, 27 May 2009 14:00:16 -0600 [thread overview]
Message-ID: <4A1D9BD0.8090508@nortel.com> (raw)
In-Reply-To: <alpine.LFD.2.00.0905271922470.3397@localhost.localdomain>
Thomas Gleixner wrote:
> On Wed, 27 May 2009, Chris Friesen wrote:
>
>
>>Thomas Gleixner wrote:
>>
>>>On Wed, 27 May 2009, Chris Friesen wrote:
>>>
>>>That's more a question for the glibc folks. CC'ed.
>>
>>Actually, I'm looking at the kernel code here. It looks like
>>posix_cpu_clock_get() should be able to handle a per-task cpu clock for
>>another thread within the same process. However, it's only ever called
>>by thread_cpu_clock_get(), which hardcodes a clock_id of THREAD_CLOCK,
>>which corresponds to the current thread.
>
>
> No, it's also called via the CLOCK_DISPATCH magic in posix_timers.c
>>Similarly, invalid_clockid() will say that the clock_id is invalid if
>>it's positive but greater than 15. If my math is right, this means that
>>any pid > 2 will result in invalid_clockid() failing.
Both invalid_clockid() and CLOCK_DISPATCH assume that the clock_id will
be negative in order to call posix_cpu_clock_get().
In pthread_getcpuclockid() in glibc, I couldn't see how we were ending
up with a negative clock_id. However, I finally clued in to the fact
that there are multiple implementations of this function, and in one
code path in one of the implementations we call MAKE_THREAD_CPUCLOCK()
which can result in a negative clock_id.
Thanks for the help.
Chris
next prev parent reply other threads:[~2009-05-27 20:00 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-05-27 16:46 linux missing support for _POSIX_THREAD_CPUTIME? Chris Friesen
2009-05-27 16:56 ` Thomas Gleixner
2009-05-27 17:14 ` Chris Friesen
2009-05-27 17:36 ` Thomas Gleixner
2009-05-27 20:00 ` Chris Friesen [this message]
2009-05-27 17:49 ` Roland McGrath
2009-05-27 17:00 ` linux missing support for _POSIX_THREAD_CPUTIME ? Chris Friesen
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=4A1D9BD0.8090508@nortel.com \
--to=cfriesen@nortel.com \
--cc=drepper@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=roland@redhat.com \
--cc=tglx@linutronix.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.