[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <4A1D9BD0.8090508@nortel.com>
Date: Wed, 27 May 2009 14:00:16 -0600
From: "Chris Friesen" <cfriesen@...tel.com>
To: Thomas Gleixner <tglx@...utronix.de>
CC: LKML <linux-kernel@...r.kernel.org>,
Ulrich Drepper <drepper@...hat.com>,
Roland McGrath <roland@...hat.com>
Subject: Re: linux missing support for _POSIX_THREAD_CPUTIME?
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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists